#23076 [Com]: in_array generates error when using object as needle
| From: | benoit dot ferlet at freesbee dot fr | Date: | Mon, 26 Jan 2004 16:41:57 +0000 |
| Subject: | #23076 [Com]: in_array generates error when using object as needle | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-53910@lists.php.net to get a copy of this message | ||
ID: 23076
Comment by: benoit dot ferlet at freesbee dot fr
Reported By: colin at omenmedia dot com
Status: Bogus
Bug Type: Arrays related
Operating System: Windows 2000
PHP Version: 4.3.1
New Comment:
I've the same Bug in the 4.3.4 php version !
when I use in_array(Object,Array) I've the wrong data type error !
Previous Comments:
------------------------------------------------------------------------
[2003-04-06 21:19:05] moriyoshi@php.net
Dupe of bug #20681
------------------------------------------------------------------------
[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