التحكم (الشروط والتكرار )
echo "<BR>";
}
print "\$a[$i] => $k.\n";
echo "<BR> End <BR>";
/* foreach example: key and value */
$a = array ( "one" => 1,
"two" => 2,
);
"three" => 3,
"seventeen" => 17
foreach($a as $k => $v) {
echo "<BR>";
print "\$a[$k] => $v.\n";
}
echo "<BR> End <BR>";
?>
<?
$arr = array ('one', 'two', 'three', 'four', 'stop', 'five'); while (list (, $val) = each ($arr)) {
if ($val
}
}
==
'stop') {
break; /* You could also write 'break 1;' here. */
echo "$val<br>\n";
/* Using the optional argument. */
$i = 0;
while (++$i) {
switch ($i) {
case 5:
echo "At 5<br>\n";
break 1; /* Exit only the switch. */
case 10:
Vo
الفصل الثالث
مثال التوقف :
ص ٧٥