mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
WS
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@165496 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
75cfb99a00
commit
3aa550f0bf
1 changed files with 30 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.101 $ -->
|
||||
<!-- $Revision: 1.102 $ -->
|
||||
<chapter id="language.control-structures">
|
||||
<title>Control Structures</title>
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
|||
<programlisting>
|
||||
<![CDATA[
|
||||
<?php
|
||||
if (expression)
|
||||
if (expression)
|
||||
statement
|
||||
?>
|
||||
]]>
|
||||
|
@ -242,7 +242,8 @@ endif;
|
|||
<informalexample>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
while (expr) statement
|
||||
while (expr)
|
||||
statement
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
@ -268,7 +269,10 @@ while (expr) statement
|
|||
<informalexample>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
while (expr): statement ... endwhile;
|
||||
while (expr):
|
||||
statement
|
||||
...
|
||||
endwhile;
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
@ -386,7 +390,8 @@ do {
|
|||
<informalexample>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
for (expr1; expr2; expr3) statement
|
||||
for (expr1; expr2; expr3)
|
||||
statement
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
@ -471,7 +476,10 @@ for ($i = 1; $i <= 10; print $i, $i++);
|
|||
<informalexample>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
for (expr1; expr2; expr3): statement; ...; endfor;
|
||||
for (expr1; expr2; expr3):
|
||||
statement
|
||||
...
|
||||
endfor;
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
@ -490,8 +498,10 @@ for (expr1; expr2; expr3): statement; ...; endfor;
|
|||
<informalexample>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
foreach (array_expression as $value) statement
|
||||
foreach (array_expression as $key => $value) statement
|
||||
foreach (array_expression as $value)
|
||||
statement
|
||||
foreach (array_expression as $key => $value)
|
||||
statement
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
@ -550,8 +560,8 @@ foreach (array_expression as $key => $value) statement
|
|||
<![CDATA[
|
||||
<?php
|
||||
$arr = array("one", "two", "three");
|
||||
reset ($arr);
|
||||
while (list(, $value) = each ($arr)) {
|
||||
reset($arr);
|
||||
while (list(, $value) = each($arr)) {
|
||||
echo "Value: $value<br />\n";
|
||||
}
|
||||
|
||||
|
@ -569,7 +579,7 @@ foreach ($arr as $value) {
|
|||
<?php
|
||||
$arr = array("one", "two", "three");
|
||||
reset($arr);
|
||||
while (list($key, $value) = each ($arr)) {
|
||||
while (list($key, $value) = each($arr)) {
|
||||
echo "Key: $key; Value: $value<br />\n";
|
||||
}
|
||||
|
||||
|
@ -663,7 +673,7 @@ foreach (array(1, 2, 3, 4, 5) as $v) {
|
|||
<![CDATA[
|
||||
<?php
|
||||
$arr = array('one', 'two', 'three', 'four', 'stop', 'five');
|
||||
while (list (, $val) = each ($arr)) {
|
||||
while (list(, $val) = each($arr)) {
|
||||
if ($val == 'stop') {
|
||||
break; /* You could also write 'break 1;' here. */
|
||||
}
|
||||
|
@ -717,11 +727,11 @@ while (++$i) {
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
while (list ($key, $value) = each ($arr)) {
|
||||
while (list($key, $value) = each($arr)) {
|
||||
if (!($key % 2)) { // skip odd members
|
||||
continue;
|
||||
}
|
||||
do_something_odd ($value);
|
||||
do_something_odd($value);
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
|
@ -997,7 +1007,8 @@ endswitch;
|
|||
<informalexample>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
declare (directive) statement
|
||||
declare (directive)
|
||||
statement
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
@ -1071,11 +1082,11 @@ function profile($dump = FALSE)
|
|||
// Return the times stored in profile, then erase it
|
||||
if ($dump) {
|
||||
$temp = $profile;
|
||||
unset ($profile);
|
||||
return ($temp);
|
||||
unset($profile);
|
||||
return($temp);
|
||||
}
|
||||
|
||||
$profile[] = microtime ();
|
||||
$profile[] = microtime();
|
||||
}
|
||||
|
||||
// Set up a tick handler
|
||||
|
@ -1092,7 +1103,7 @@ declare(ticks=2) {
|
|||
}
|
||||
|
||||
// Display the data stored in the profiler
|
||||
print_r(profile (TRUE));
|
||||
print_r(profile(TRUE));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
Loading…
Reference in a new issue