derick Wed Aug 28 05:40:31 2002 EDT Modified files: /phpdoc/en/language control-structures.xml Log: - Clearify foreach()' behavior on wrong data types Index: phpdoc/en/language/control-structures.xml diff -u phpdoc/en/language/control-structures.xml:1.62 phpdoc/en/language/control-structures.xml:1.63 --- phpdoc/en/language/control-structures.xml:1.62 Sun Aug 25 16:07:05 2002 +++ phpdoc/en/language/control-structures.xml Wed Aug 28 05:40:31 2002 @@ -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 @@ <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[
-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php