Folders renumbered

Folders renumbered
This commit is contained in:
RobinNixon
2020-12-10 13:35:00 +00:00
parent d0519f0697
commit e311e3750d
153 changed files with 2 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
<?php
echo "a: [" . (20 > 9) . "]<br>";
echo "b: [" . (5 == 6) . "]<br>";
echo "c: [" . (1 == 0) . "]<br>";
echo "d: [" . (1 == 1) . "]<br>";
?>
+4
View File
@@ -0,0 +1,4 @@
<?php // test2.php
echo "a: [" . TRUE . "]<br>";
echo "b: [" . FALSE . "]<br>";
?>
+10
View File
@@ -0,0 +1,10 @@
<?php
$myname = "Brian";
$myage = 37;
echo "a: " . 73 . "<br>"; // Numeric literal
echo "b: " . "Hello" . "<br>"; // String literal
echo "c: " . FALSE . "<br>"; // Constant literal
echo "d: " . $myname . "<br>"; // String variable
echo "e: " . $myage . "<br>"; // Numeric variable
?>
+9
View File
@@ -0,0 +1,9 @@
<?php
$day_number = 340; // Assignment by Value
$days_to_new_year = 366 - $day_number; // Assignment by Expression
if ($days_to_new_year < 30) // Condition
{
echo "Not long now till new year"; // Statement
}
?>
+3
View File
@@ -0,0 +1,3 @@
<?php
$level = $score = $time = 0;
?>
+5
View File
@@ -0,0 +1,5 @@
<?php
$month = "March";
if ($month == "March") echo "It's springtime";
?>
+7
View File
@@ -0,0 +1,7 @@
<?php
$a = "1000";
$b = "+1000";
if ($a == $b) echo "1";
if ($a === $b) echo "2";
?>
+7
View File
@@ -0,0 +1,7 @@
<?php
$a = "1000";
$b = "+1000";
if ($a != $b) echo "1";
if ($a !== $b) echo "2";
?>
+7
View File
@@ -0,0 +1,7 @@
<?php
$a = 2; $b = 3;
if ($a > $b) echo "$a is greater than $b<br>";
if ($a < $b) echo "$a is less than $b<br>";
if ($a >= $b) echo "$a is greater than or equal to $b<br>";
if ($a <= $b) echo "$a is less than or equal to $b<br>";
?>
+8
View File
@@ -0,0 +1,8 @@
<?php
$a = 1; $b = 0;
echo ($a AND $b) . "<br>";
echo ($a or $b) . "<br>";
echo ($a XOR $b) . "<br>";
echo !$a . "<br>";
?>
+3
View File
@@ -0,0 +1,3 @@
<?php
if ($finished == 1 or getnext() == 1) exit;
?>
+5
View File
@@ -0,0 +1,5 @@
<?php
$gn = getnext();
if ($finished == 1 or $gn == 1) exit;
?>
+7
View File
@@ -0,0 +1,7 @@
<?php
if ($bank_balance < 100)
{
$money = 1000;
$bank_balance += $money;
}
?>
+12
View File
@@ -0,0 +1,12 @@
<?php
if ($bank_balance < 100)
{
$money = 1000;
$bank_balance += $money;
}
else
{
$savings += 50;
$bank_balance -= 50;
}
?>
+17
View File
@@ -0,0 +1,17 @@
<?php
if ($bank_balance < 100)
{
$money = 1000;
$bank_balance += $money;
}
elseif ($bank_balance > 200)
{
$savings += 100;
$bank_balance -= 100;
}
else
{
$savings += 50;
$bank_balance -= 50;
}
?>
+10
View File
@@ -0,0 +1,10 @@
<?php
$page = "test";
if ($page == "Home") echo "You selected Home";
elseif ($page == "About") echo "You selected About";
elseif ($page == "News") echo "You selected News";
elseif ($page == "Login") echo "You selected Login";
elseif ($page == "Links") echo "You selected Links";
else echo "Unrecognized selection";
?>
+15
View File
@@ -0,0 +1,15 @@
<?php
switch ($page)
{
case "Home": echo "You selected Home";
break;
case "About": echo "You selected About";
break;
case "News": echo "You selected News";
break;
case "Login": echo "You selected Login";
break;
case "Links": echo "You selected Links";
break;
}
?>
+23
View File
@@ -0,0 +1,23 @@
<?php
switch ($page)
{
case "Home":
echo "You selected Home";
break;
case "About":
echo "You selected About";
break;
case "News":
echo "You selected News";
break;
case "Login":
echo "You selected Login";
break;
case "Links":
echo "You selected Links";
break;
default:
echo "Unrecognized selection";
break;
}
?>
+13
View File
@@ -0,0 +1,13 @@
<?php
switch ($page):
case "Home":
echo "You selected Home";
break;
// etc...
case "Links":
echo "You selected Links";
break;
endswitch;
?>
+3
View File
@@ -0,0 +1,3 @@
<?php
echo $fuel <= 1 ? "Fill tank now" : "There's enough fuel";
?>
+3
View File
@@ -0,0 +1,3 @@
<?php
$enough = $fuel <= 1 ? FALSE : TRUE;
?>
+9
View File
@@ -0,0 +1,9 @@
<?php
$fuel = 10;
while ($fuel > 1)
{
// Keep driving …
echo "There's enough fuel";
}
?>
+9
View File
@@ -0,0 +1,9 @@
<?php
$count = 1;
while ($count <= 12)
{
echo "$count times 12 is " . $count * 12 . "<br>";
++$count;
}
?>
+6
View File
@@ -0,0 +1,6 @@
<?php
$count = 0;
while (++$count <= 12)
echo "$count times 12 is " . $count * 12 . "<br>";
?>
+7
View File
@@ -0,0 +1,7 @@
<?php
$count = 1;
do
echo "$count times 12 is " . $count * 12 . "<br>";
while (++$count <= 12);
?>
+8
View File
@@ -0,0 +1,8 @@
<?php
$count = 1;
do {
echo "$count times 12 is " . $count * 12;
echo "<br>";
} while (++$count <= 12);
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
for ($count = 1 ; $count <= 12 ; ++$count)
echo "$count times 12 is " . $count * 12 . "<br>";
?>
+7
View File
@@ -0,0 +1,7 @@
<?php
for ($count = 1 ; $count <= 12 ; ++$count)
{
echo "$count times 12 is " . $count * 12;
echo "<br>";
}
?>
+12
View File
@@ -0,0 +1,12 @@
<?php
$fp = fopen("text.txt", 'wb');
for ($j = 0 ; $j < 100 ; ++$j)
{
$written = fwrite($fp, "data");
if ($written == FALSE) break;
}
fclose($fp);
?>
+12
View File
@@ -0,0 +1,12 @@
<?php
$j = 10;
while ($j > -10)
{
$j--;
if ($j == 0) continue;
echo (10 / $j) . "<br>";
}
?>
+7
View File
@@ -0,0 +1,7 @@
<?php
$a = 56;
$b = 12;
$c = $a / $b;
echo $c;
?>