---code----------------------------
class File {
public $var;
function __construct($val) {
$this->var = $val;
}
}$t1 = new File("test");
$t2 = new File("test");print_r($t1); print_r($t2);
print "\$t1 == \$t2 ?";
if ($t1 == $t2) {
print "YES\n";
} else {
print "NO\n";
}---output----------------------------
File Object
(
[var] => test
)
File Object
(
[var] => test
)
$t1 == $t2 ?
Notice: Object of class File could not be converted to integer in /var/www/apps/ddi/test.php on line 18
Notice: Object of class File could not be converted to integer in /var/www/apps/ddi/test.php on line 18
YES
I don't know why anything is being coverted to an _integer_. Is this intended behavior? If so, how do I do a PHP4-style object contents comparison? Using === doesn't produce any notice, but also means something very different of course.
Hans
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
