From 7c76608a20c89ad54679fbebb49af55b5b2a0a47 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Wed, 28 Aug 2002 09:40:31 +0000 Subject: [PATCH] - Clearify foreach()' behavior on wrong data types git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@93917 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/control-structures.xml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/language/control-structures.xml b/language/control-structures.xml index 675aa4c064..2ba21145b4 100644 --- a/language/control-structures.xml +++ b/language/control-structures.xml @@ -1,5 +1,5 @@ - + Control Structures @@ -472,10 +472,12 @@ for (expr1; expr2; expr3): statement; ...; endfor; <literal>foreach</literal> - PHP 4 (not PHP 3) includes a foreach 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 foreach construct, much + like Perl and some other languages. This simply gives an easy way to + iterate over arrays. foreach 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: