note 90361 added to function.in-array

From: Date: Fri, 17 Apr 2009 17:46:27 +0000
Subject: note 90361 added to function.in-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-153450@lists.php.net to get a copy of this message
This function will generate a PHP_NOTICE if you are looking for data of type A in an array containing data of type B if casting A to B would generate a PHP_NOTICE. This may not be obvious. For example: <?php $o = new stdClass; $a = array(1, 2, $o); in_array(5, $a); ?> The output here is: Notice: Object of class stdClass could not be converted to int in /some/script.php on line 5 ---- Server IP: 208.69.120.35 Probable Submitter: 168.122.64.148 ---- Manual Page -- http://www.php.net/manual/en/function.in-array.php Edit -- https://master.php.net/note/edit/90361 Del: integrated -- https://master.php.net/note/delete/90361/integrated Del: useless -- https://master.php.net/note/delete/90361/useless Del: bad code -- https://master.php.net/note/delete/90361/bad+code Del: spam -- https://master.php.net/note/delete/90361/spam Del: non-english -- https://master.php.net/note/delete/90361/non-english Del: in docs -- https://master.php.net/note/delete/90361/in+docs Del: other reasons-- https://master.php.net/note/delete/90361 Reject -- https://master.php.net/note/reject/90361 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#153450) next »