#19997 [Bgs]: explode() has bug

From: Date: Sun, 20 Oct 2002 19:21:43 +0000
Subject: #19997 [Bgs]: explode() has bug
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-22889@lists.php.net to get a copy of this message
ID: 19997 Updated by: rasmus@php.net Reported By: adin@austin.rr.com Status: Bogus Bug Type: Unknown/Other Function Operating System: Linux (Enigma) PHP Version: 4.2.1 New Comment: Your for loop will obviously not start if $split[0] is 0 since you are using $split[$x] directly as your condition expression. 0 evaluates to false. Use a foreach() loop instead. Previous Comments: ------------------------------------------------------------------------ [2002-10-20 01:34:17] iliaa@php.net Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Thank you for your interest in PHP. Works fine in CVS. ------------------------------------------------------------------------ [2002-10-20 01:00:50] adin@austin.rr.com $split = explode("|", $DaysOfWeek); for ($x = 0; $split[$x]; $x++) { echo $split[$x]."\n"; } //if $DaysOfWeek starts with 0 (eg. 0|1|2) then $split //gets blanked. 1|2|3 or any other combination is fine. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19997&edit=1

« previous php.bugs (#22889) next »