note 104501 added to function.in-array

From: Date: Sat, 18 Jun 2011 19:16:44 +0000
Subject: note 104501 added to function.in-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-180659@lists.php.net to get a copy of this message
known issue when checking a string vs a integer $testarray = array(0,1,2,3,4); in_array("bla", $a) returns true in_array("bla6", $a) returns true in_array("6bla", $a) returns false "bla" as a integer value returns the number zero "bla6" as a integer value returns the number zero "6bla" returns the number six as its the only vaild part of that if you checking for unknown types eg string vs integer then you would need the strict value to be true. ---- Server IP: 69.147.83.197 Probable Submitter: 82.5.27.3 ---- Manual Page -- http://www.php.net/manual/en/function.in-array.php Edit -- https://master.php.net/note/edit/104501 Del: integrated -- https://master.php.net/note/delete/104501/integrated Del: useless -- https://master.php.net/note/delete/104501/useless Del: bad code -- https://master.php.net/note/delete/104501/bad+code Del: spam -- https://master.php.net/note/delete/104501/spam Del: non-english -- https://master.php.net/note/delete/104501/non-english Del: in docs -- https://master.php.net/note/delete/104501/in+docs Del: other reasons-- https://master.php.net/note/delete/104501 Reject -- https://master.php.net/note/reject/104501 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#180659) next »