adding file for working through looping control structures

This commit is contained in:
Dan Buch 2010-12-29 21:30:13 -05:00
parent ea522b13e7
commit b39eaef485

34
docroot/html/loops.php Normal file
View File

@ -0,0 +1,34 @@
<pre>
<?php
$c = 0;
while ($c < 5) {
print $c++ . "\n";
}
?>
</pre>
<pre>
<?php
$myname = "Fred";
$i = 0;
while ($myname != "Rumpelstiltskin") {
print $i++ . ": ";
if ($myname == "Fred") {
$myname = "Leslie";
} else {
$myname = "Rumpelstiltskin";
}
print "$myname\n";
}
print "How did you know?\n";
?>
</pre>