#20645 [Opn->Bgs]: function array_search return zero instead of false!

From: Date: Tue, 26 Nov 2002 17:26:00 +0000
Subject: #20645 [Opn->Bgs]: function array_search return zero instead of false!
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-25869@lists.php.net to get a copy of this message
ID: 20645 Updated by: moriyoshi@php.net Reported By: hzerres@aol.com -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: win2k PHP Version: 4.2.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 You have to use "!==" operator when you want to distinguish 0 and false. Previous Comments: ------------------------------------------------------------------------ [2002-11-26 07:56:58] hzerres@aol.com I try to find some entry in an Array beginning with index 0. I test for false to treat the "not found" event but don´t find my entrys in the first line. If i test for 0 i always end up with my fist line. $this->wochentage_name=array( array(0,"Monday","Montag","Mo"), array(1,"Tuesday","Dienstag","Di"), array(2,"Wednesday","Mittwoch","Mi"), array(3,"Thursday","Donnerstag","Do"), array(4,"Friday","Freitag","Fr"), array(5,"Saturday","Samstag","Sa"), array(6,"Sunday","Sonntag","So") ); for($i=0;$i<sizeof($this->wochentage_name);$i++) { print_r($this->wochentage_name[$i]); echo "ENDE für Nummer".$i."<br>"; $key = array_search($in,$this->wochentage_name[$i]); if($key != 0) { return $this->wochentage_name[$i][$row]; } } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20645&edit=1

« previous php.bugs (#25869) next »