";
switch ($pi)
{
case 1.618:
break;
case 3.14159:
echo "cought it.
";
break;
default:
echo "how could this happen?
";
break;
}
/* while and for are straightforward, foreach is interesting, it allows us
* to loop through assosiative arrays, aka key-value pair */
$myarr = array("world" => "evil", "bro" => "ski", "he" => "is good man");
foreach ($myarr as $value)
echo "the value is \"{$value}\"
";
echo "
";
foreach ($myarr as $key => $value) /* fucking weird */
echo "at {$key} the value is \"{$value}\"
";
echo '
$myarr points to "' . current($myarr) . "\".
";
reset($myarr);
next($myarr);
echo '$myarr now points to "' . current($myarr) . "\".
";
/* incrementing pointer */
while ($str = current($myarr))
{
echo $str . ", ";
next($myarr);
}
?>