#23076 [Opn->Bgs]: in_array generates error when using object as needle

From: Date: Mon, 07 Apr 2003 02:19:06 +0000
Subject: #23076 [Opn->Bgs]: in_array generates error when using object as needle
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37235@lists.php.net to get a copy of this message
ID: 23076 Updated by: moriyoshi@php.net Reported By: colin at omenmedia dot com -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: Windows 2000 PHP Version: 4.3.1 New Comment: Dupe of bug #20681 Previous Comments: ------------------------------------------------------------------------ [2003-04-06 21:06:51] colin at omenmedia dot com PHP is reporting a "Wrong datatype for first argument" error when using an object as the needle argument for the in_array() function. The code below will generate the error: <?php class Foo { } $foo = new Foo(); $test = array(1,2,3,4,5); if (in_array($foo,$test)) { print "Yes"; } else { print "No"; } ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23076&edit=1

« previous php.bugs (#37235) next »