note 81682 deleted from control-structures.foreach by philip

From: Date: Wed, 18 Jun 2008 00:09:16 +0000
Subject: note 81682 deleted from control-structures.foreach by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-140546@lists.php.net to get a copy of this message
Note Submitter: Amaroq ---- Even if an array has only one value, it is still an array and foreach will run it. <?php $arr[] = "I'm an array."; if(is_array($arr)) { foreach($arr as $val) { echo $val; } } ?> The above code outputs: I'm an array.

« previous php.notes (#140546) next »