- 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:
Derick Rethans 2002-08-28 09:40:31 +00:00
parent d7d6d8252e
commit 7c76608a20

View file

@ -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[