note 114117 added to function.in-array

From: Date: Mon, 13 Jan 2014 01:02:22 +0000
Subject: note 114117 added to function.in-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-198217@lists.php.net to get a copy of this message
Watch out for this: <? print_r( (int) in_array('hello',array( 0 => 0)) ); ?> returns 1 Yes, it seems that is_array thinks that a random string and 0 are the same thing. Excuse me, that's not loose checking, that's drunken logic. Or maybe I found a bug? ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/function.in-array.php Edit -- https://master.php.net/note/edit/114117 Del: integrated -- https://master.php.net/note/delete/114117/integrated Del: useless -- https://master.php.net/note/delete/114117/useless Del: bad code -- https://master.php.net/note/delete/114117/bad+code Del: spam -- https://master.php.net/note/delete/114117/spam Del: non-english -- https://master.php.net/note/delete/114117/non-english Del: in docs -- https://master.php.net/note/delete/114117/in+docs Del: other reasons-- https://master.php.net/note/delete/114117 Reject -- https://master.php.net/note/reject/114117 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198217) next »