Hi Rob, no prob. I could not find any reference to comparing objects in the PHP manual. So if you have any other PHP versions around, you might like to try the script with them as well. And to be honest, I would not rely on that behaviour. I'd rather define a class method for comparisons like if ($obj1->equals($obj2)) ... Jens > -----Original Message----- > From: Rob [mailto:rcherry@jamwarehouse.com] > Sent: Friday, January 17, 2003 11:02 AM > To: php-objects@yahoogroups.com > Subject: RE: [php-objects] Object comparison in php > > > Thanks dude !!! > > --- > Rob > > ************************** > Rob Cherry > mailto:rob@jamwarehouse.com > +27 21 447 7440 > Jam Warehouse RSA > Smart Business Innovation > http://www.jamwarehouse.com > ************************** > > > -----Original Message----- > From: Jens Vonderheide [mailto:jens@vdheide.de] > Sent: Friday, January 17, 2003 11:57 AM > To: php-objects@yahoogroups.com > Subject: RE: [php-objects] Object comparison in php > > > Hi Rob, > > seems like PHP is comparing the values: > > <?php > class Tst { > } > > $obj1 = new Tst(); > $obj2 = $obj1; > $obj1->a = "a"; > $obj2->a = "a"; > echo "Test 1: " . ($obj1 == $obj2 ? 'equal' : 'not equal') . "\n"; > > $obj1->a = "a"; > $obj2->a = "b"; > echo "Test 2: " . ($obj1 == $obj2 ? 'equal' : 'not equal') . "\n"; > > $obj1 = & new Tst(); > $obj2 = & $obj1; > echo "Test 3: " . ($obj1 == $obj2 ? 'equal' : 'not equal') . "\n"; > ?> > > Output (with PHP 4.2.3): > Test 1: equal > Test 2: not equal > Test 3: equal > > > > -----Original Message----- > > From: Rob [mailto:rcherry@jamwarehouse.com] > > Sent: Thursday, January 16, 2003 11:14 AM > > To: phpobj > > Subject: [php-objects] Object comparison in php > > > > > > If I have two object in php, how does the == operator work? > > > > E.g. > > > > $obj1 = new Object(); > > $obj2 = $obj1 > > > > what is the result of ($obj1 == $obj2)? > > > > What about this? > > > > $obj1 = & new Object(); > > $obj2 = & $obj1 > > > > what is the result of ($obj1 == $obj2)? > > > > Does the == operator do a memory location comparison for > objects, or does > > it actually comare the values within the object? > > > > > > Look here for Free PHP Classes of objects: > http://phpclasses.UpperDesign.com/ > To unsubscribe from this group, send an email to: > php-objects-unsubscribe@egroups.com > > > > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ > > > > > > Look here for Free PHP Classes of objects: > http://phpclasses.UpperDesign.com/ > To unsubscribe from this group, send an email to: > php-objects-unsubscribe@egroups.com > > > > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ > > > ------------------------ Yahoo! Groups Sponsor ---------------------~--> Turn flat surfaces into speakers with the Soundbug. http://us.click.yahoo.com/QWAVSC/onCFAA/xGHJAA/saFolB/TM ---------------------------------------------------------------------~-> Look here for Free PHP Classes of objects: http://phpclasses.UpperDesign.com/ To unsubscribe from this group, send an email to: php-objects-unsubscribe@egroups.com Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/