Bug #10658: array_diff does not work with classes
| From: | mihai dot negrea at spidernet dot co dot ro | Date: | Fri, 04 May 2001 07:36:47 +0000 |
| Subject: | Bug #10658: array_diff does not work with classes | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-53774@lists.php.net to get a copy of this message | ||
From: mihai.negrea@spidernet.co.ro
Operating system: Linux
PHP version: 4.0.5
PHP Bug Type: Arrays related
Bug description: array_diff does not work with classes
Consider the following script:
<?
class test
{
var $x;
var $y;
function test ()
{
$this->x = 0;
$this->y = 0;
}
function set ($x, $y)
{
$this->x = $x;
$this->y = $y;
}
}
$mumu = array();
$gaga = array();
for($i=0;$i<3;$i++)
{
$test = new test ();
$test->set($i, $i);
$mumu["xx".$i] = $test;
}
for($i=0;$i<5;$i++)
{
$test = new test ();
$test->set($i, $i);
$gaga["xx".$i] = $test;
}
$fff = array_diff($mumu, $gaga);
$ggg = array_diff($gaga, $mumu);
echo "<pre>";
print_r($fff);
echo "</pre>";
echo "<pre>";
print_r($ggg);
echo "</pre>";
?>
the following is the output from a server with php
4.0.4pl1:
Array
(
)
Array
(
[xx3] => test Object
(
[x] => 3
[y] => 3
)
[xx4] => test Object
(
[x] => 4
[y] => 4
)
)
and the following is the ouput with php 4.0.5:
Array
(
)
Array
(
)
the php.ini is the same on both servers.
--
Edit Bug report at: http://bugs.php.net/?id=10658&edit=1