note 94076 added to control-structures.foreach

From: Date: Thu, 15 Oct 2009 09:56:46 +0000
Subject: note 94076 added to control-structures.foreach
Groups: php.notes 
Request: Send a blank email to php-notes+get-161757@lists.php.net to get a copy of this message
megazzt, you probably have a null value, not an empty array. You shouldn't have any problems if you pass in an array with no values. If you pass in a "null" then it is correct that foreach is unhappy about that. You could of course check the variable first with is_array() or empty(). ---- Server IP: 208.69.120.35 Probable Submitter: 83.169.152.141 ---- Manual Page -- http://www.php.net/manual/en/control-structures.foreach.php Edit -- https://master.php.net/note/edit/94076 Del: integrated -- https://master.php.net/note/delete/94076/integrated Del: useless -- https://master.php.net/note/delete/94076/useless Del: bad code -- https://master.php.net/note/delete/94076/bad+code Del: spam -- https://master.php.net/note/delete/94076/spam Del: non-english -- https://master.php.net/note/delete/94076/non-english Del: in docs -- https://master.php.net/note/delete/94076/in+docs Del: other reasons-- https://master.php.net/note/delete/94076 Reject -- https://master.php.net/note/reject/94076 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#161757) next »