Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: PHP Composer

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-

- name: Install dependencies
run: composer install --prefer-dist --no-progress

# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md

# - name: Run test suite
# run: composer run-script test
Binary file added 01.Whataresessionsandcookies.pdf
Binary file not shown.
Binary file added ALLABOUTME.pdf
Binary file not shown.
Binary file added UDEMY_BEGINNERS/01.Whataresessionsandcookies.pdf
Binary file not shown.
Binary file added UDEMY_BEGINNERS/Aroundtheworldin80days.pdf
Binary file not shown.
Binary file added UDEMY_BEGINNERS/Capitalcitiesoftheworld.pdf
Binary file not shown.
Binary file added UDEMY_BEGINNERS/CarpeDiem.pdf
Binary file not shown.
Binary file added UDEMY_BEGINNERS/Challenge+1.pdf
Binary file not shown.
17 changes: 17 additions & 0 deletions UDEMY_BEGINNERS/Darts/darts.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.tableCell {
background-color: #9dd1a2;
text-align: right;
}

.headerCell {
background-color: #9dbfd1;
text-align: center;
}

td, th, .table {
border: 1px solid black !important;
}

th,td {
text-align: center;
}
145 changes: 145 additions & 0 deletions UDEMY_BEGINNERS/Darts/darts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<?php
$max = 4;
$maxDartScore = $max*3;
$score=[];
for($dart1=0; $dart1<=$max; $dart1++){
for($dart2=$dart1; $dart2<=$max; $dart2++){
for($dart3=$dart2; $dart3<=$max; $dart3++){
$total = $dart1 + $dart2 + $dart3;
$score[$total]+=1;
}
}
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Darts</title>
<link rel="stylesheet" href="//bootswatch.com/3/flatly/bootstrap.min.css">
<link rel="stylesheet" href="darts.css">

<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">

// Load the Visualization API and the corechart package.
google.charts.load('current', {'packages':['corechart']});

// Set a callback to run when the Google Visualization API is loaded.
google.charts.setOnLoadCallback(drawChart);

// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {

// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Score');
data.addColumn('number', 'Number of possible ways');
data.addRows([

<?

for($i=0; $i<=$maxDartScore; $i++){
echo "['$i',$score[$i]],";
}

?>


]);

// Set chart options
var options = { title:'DARTS: Number of Possible Ways to Score',
width:600,
height:500,
legend:'none',
vAxis: {title: "# of Possible Ways",ticks:[0,1,2,3,4,5,6]},
hAxis: {title: "Score"}
};

// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
google.visualization.events.addListener(chart, 'ready', function () {
chart_div.innerHTML = '<img src="' + chart.getImageURI() + '">';
});
chart.draw(data, options);
}
</script>

</head>
<body>
<div class="container">
<br>
<div class="col-md-12">
<table class="table table-bordered">
<thead>
<tr>
<th class="tableCell">SCORE</th>
<?php
for($th=0;$th<=$maxDartScore;$th++){
echo "<th>$th</th>";
}
?>
</tr>
</thead>
<tbody>
<tr>
<td class="tableCell"><strong>No. OF POSSIBLE WAYS</strong></td>
<?php
for($i=0;$i<=$maxDartScore;$i++){
echo "<td>$score[$i]</td>";
}
?>
</tr>
</tbody>
</table>
</div>
<div class="row">
<div class="col-md-6">

<table class="table table-bordered">
<thead>
<tr>
<th class="headerCell">DART 1</th>
<th class="headerCell">DART 2</th>
<th class="headerCell">DART 3</th>
<th class="headerCell">TOTAL</th>
<tr></tr>
</thead>
<tbody>

<?php

$score=[];
for($dart1=0; $dart1<=$max; $dart1++){
for($dart2=$dart1; $dart2<=$max; $dart2++){
for($dart3=$dart2; $dart3<=$max; $dart3++){
$total = $dart1 + $dart2 + $dart3;
$score[$total]+=1;
echo "<tr>";
echo "<td>$dart1</td><td>$dart2</td><td>$dart3</td><td>$total</td>";
echo "</tr>";
}
}
}

?>

</tbody>
</table>



</div>
<div class="col-md-6">
<div id="chart_div"></div>
</div>
</div>
</div>
</body>
</html>
Binary file added UDEMY_BEGINNERS/Discount+Codes.pdf
Binary file not shown.
Binary file added UDEMY_BEGINNERS/ExtensionChallenges.pdf
Binary file not shown.
Binary file added UDEMY_BEGINNERS/FizzBuzzChallenge.pdf
Binary file not shown.
Binary file added UDEMY_BEGINNERS/HITMEBABYONEMORETIME.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>String Length</title>
</head>

<body>
<form action="string-length-processor.php" method="post">
<input type="text" name="string">
Y<input type="radio" name="spaces" value="Y">
N<input type="radio" name="spaces" value="N">
<input type="submit" name="submit" value="COUNT">
</form>
</body>

</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

if(isset($_POST['submit'])){
$sentence = $_POST['string'];
$spaces = $_POST['spaces'];
if($spaces == "Y"){
$sentenceLength = strlen(str_replace(" ", "", $sentence));
} else {
$sentenceLength = strlen($sentence);
}

echo "The sentence is $sentenceLength characters long";
}
Binary file not shown.
Binary file added UDEMY_BEGINNERS/ISBN+Checker.pdf
Binary file not shown.
15 changes: 15 additions & 0 deletions UDEMY_BEGINNERS/ISBN/isbn-form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ISBN Checker</title>
</head>
<body>
<form action="isbn-processor.php" method="post">
<input type="text" name="isbn">
<input type="submit" name="submit" value="CHECK">
</form>
</body>
</html>
30 changes: 30 additions & 0 deletions UDEMY_BEGINNERS/ISBN/isbn-processor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

//check if form submitted
if(isset($_POST['submit'])){
//assign post variable isbn number
$isbn = $_POST['isbn'];

//total, incrementor
$total = 0;
$i = 1;

//split the string
$digits = str_split($isbn);

//loop through the array
foreach($digits as $digit){
//update the total = digit *1, 2, 3 etc
$total += $digit * $i;
$i++;
}

//check if total / 11

if($total % 11 == 0){
echo "Valid";
} else {
echo "Invalid";
}

}
Binary file added UDEMY_BEGINNERS/Itsgettinghotinhere.pdf
Binary file not shown.
Binary file added UDEMY_BEGINNERS/Lets+Go+Shopping.pdf
Binary file not shown.
15 changes: 15 additions & 0 deletions UDEMY_BEGINNERS/Lets+Go+Shopping/shopping-form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Credit Card Checker</title>
</head>
<body>
<form action="shopping-processor.php" method="post">
<input type="text" name="cc">
<input type="submit" name="submit" value="CHECK">
</form>
</body>
</html>
53 changes: 53 additions & 0 deletions UDEMY_BEGINNERS/Lets+Go+Shopping/shopping-processor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

//check if form submitted
if(isset($_POST['submit'])){
//assign variables, total, incrementor
$ccNumber = $_POST['cc'];
$total = 0;
$i = 1;

//get last 4 digits
$last4 = substr($ccNumber, -4, 4);

//split string into array
$ccNumber = str_split($ccNumber);

//reverse array
$ccNumber = array_reverse($ccNumber);

//loop through the array and calculate
foreach($ccNumber as $digit){
//if even digit
if($i % 2 == 0){
//multiply by 2
$digit *= 2;
//if digit > 9
if($digit > 9){
//subtract 9
$digit -= 9;
}
}
//total = total + digit
$total += $digit;
//incrementor + 1
$i++;
}


//check total / 10
if($total % 10 == 0){
echo "Your credit card number with last 4 digits " . $last4 . " is valid";
} else {
echo "Your credit card number with last 4 digits " . $last4 . " is invalid";
}


}


//outside of message check




Binary file added UDEMY_BEGINNERS/Mindyourlanguage.pdf
Binary file not shown.
Binary file added UDEMY_BEGINNERS/MissionImpossible.pdf
Binary file not shown.
Binary file added UDEMY_BEGINNERS/MultiplesChallenge.pdf
Binary file not shown.
Binary file added UDEMY_BEGINNERS/Odds+or+Evens.pdf
Binary file not shown.
Binary file added UDEMY_BEGINNERS/Palindrome+Php
Binary file not shown.
Binary file added UDEMY_BEGINNERS/Pickacard.pdf
Binary file not shown.
Binary file added UDEMY_BEGINNERS/SantaClausiscomingtotown.pdf
Binary file not shown.
Binary file not shown.
Binary file added UDEMY_BEGINNERS/TheGreatEscape.pdf
Binary file not shown.
Binary file added UDEMY_BEGINNERS/Whoateallthepi.pdf
Binary file not shown.
27 changes: 27 additions & 0 deletions UDEMY_BEGINNERS/around-the-world.php/around-the-world.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

$string = "London, Paris, Amsterdam, New York, Berlin, Brisbane";

$cities = explode(", ", $string);

sort($cities);

echo "<ol>";

foreach($cities as $city){
echo "<li>$city</li>";
}

echo "</ol>";

array_push($cities, "Sydney", "Helsinki", "Beijing", "Dublin", "Rome");

sort($cities);

echo "<ol>";

foreach ($cities as $city) {
echo "<li>$city</li>";
}

echo "</ol>";
Loading