mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
- Clearify foreach()' behavior on wrong data types
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@93917 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
d7d6d8252e
commit
7c76608a20
1 changed files with 7 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.62 $ -->
|
||||
<!-- $Revision: 1.63 $ -->
|
||||
<chapter id="control-structures">
|
||||
<title>Control Structures</title>
|
||||
|
||||
|
@ -472,10 +472,12 @@ for (expr1; expr2; expr3): statement; ...; endfor;
|
|||
<sect1 id="control-structures.foreach">
|
||||
<title><literal>foreach</literal></title>
|
||||
<para>
|
||||
PHP 4 (not PHP 3) includes a <literal>foreach</literal> construct,
|
||||
much like Perl and some other languages. This simply gives an easy
|
||||
way to iterate over arrays. There are two syntaxes; the second is
|
||||
a minor but useful extension of the first:
|
||||
PHP 4 (not PHP 3) includes a <literal>foreach</literal> construct, much
|
||||
like Perl and some other languages. This simply gives an easy way to
|
||||
iterate over arrays. <literal>foreach</literal> works only on arrays, and
|
||||
will issue an error when you try to use it on a variable with a different
|
||||
data type or an uninitialized variables. There are two syntaxes; the
|
||||
second is a minor but useful extension of the first:
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
|
Loading…
Reference in a new issue