#24754 [Opn->Bgs]: each() seems to return BOOL instead of ARRAY

From: Date: Tue, 22 Jul 2003 17:25:39 +0000
Subject: #24754 [Opn->Bgs]: each() seems to return BOOL instead of ARRAY
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-44525@lists.php.net to get a copy of this message
ID: 24754 Updated by: derick@php.net Reported By: web at developer dot bg -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: Windows2000 Adv Server PHP Version: 4.3.2 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Read the manual about operator precedence again. Previous Comments: ------------------------------------------------------------------------ [2003-07-22 12:20:08] web at developer dot bg Description: ------------ Under certain circumstances a variable storing the result of each() contains the boolean TRUE instead of the array or FALSE that is normaly expected. The code will give you an idea what exactly is the problem. Reproduce code: --------------- $arr = array('apple', 'banana', 'strawberry', 'pineapple', 'orange'); $i = 0; while($fruit=each($arr) || $i>=3) { echo $fruit[value].'<br>'; $i++; } Expected result: ---------------- apple banana strawberry Actual result: -------------- 1 1 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24754&edit=1

« previous php.bugs (#44525) next »