Re: [php-objects] Object comparison in php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



See the bug report at:

   http://bugs.php.net/bug.php?id=20842

When I get some more time I will have to get around documenting the behaviour
in the manual.


--- Rob <rcherry@jamwarehouse.com> wrote:
> 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?
> 
> Thanks
> 
> ---
> Rob
> 
> **************************
> Rob Cherry
> mailto:rob@jamwarehouse.com
> +27 21 447 7440 
> Jam Warehouse RSA
> Smart Business Innovation
> http://www.jamwarehouse.com
> **************************
>   
> 
> -----Original Message-----
> From: Rob [mailto:rcherry@jamwarehouse.com]
> Sent: Friday, January 10, 2003 11:08 AM
> To: php-objects@yahoogroups.com
> Subject: RE: [php-objects] FW: types in php
> 
> 
> Awesome, thanks!!
> 
> ---
> Rob
> 
> **************************
> Rob Cherry
> mailto:rob@jamwarehouse.com
> +27 21 447 7440 
> Jam Warehouse RSA
> Smart Business Innovation
> http://www.jamwarehouse.com
> **************************
>   
> 
> -----Original Message-----
> From: John Luxford [mailto:lux@simian.ca]
> Sent: Friday, January 10, 2003 10:59 AM
> To: php-objects@yahoogroups.com
> Subject: Re: [php-objects] FW: types in php
> 
> 
> 
> On Friday, January 10, 2003, at 02:33 AM, Rob wrote:
> > But what happens if I get back a key of 0, since 0 in php is 
> > equivalent to
> > false?  Is there any way to check whether
> > $key came back as an int or a bool?
> 
> Try
> 
> if ($key === false) {
>    // false it is
> }
> 
> The third '=' compares the two to see that they are also of the same 
> type.  Or if you just want to check the type and not the value, check 
> out the function http://www.php.net/is_bool and the related functions 
> listed on that page.
> 
> Cheers,
> 
> Lux
> 
> >
> > Thanks
> >
> > ---
> > Rob
> >
> > **************************
> > Rob Cherry
> > mailto:rob@jamwarehouse.com
> > +27 21 447 7440
> > Jam Warehouse RSA
> > Smart Business Innovation
> > http://www.jamwarehouse.com
> > **************************
> 
> --
> 
> John Luxford
> President and Chief Developer
> ______________________________
> SIMIAN systems
> Driving Web Content Management
> ______________________________
> web   : http://www.simian.ca/
> email : lux@simian.ca
> phone : 204.946.5955
> 
> 
> 
> 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/ 
> 
> 
> 
> 
> 
> 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/ 
> 
> 


=====
--- Jesus M. Castagnetto (jcastagnetto@yahoo.com)

Research:
 http://metallo.scripps.edu/
Personal: http://www.castagnetto.org/

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Flexible Keyboard is the ideal accessory for PDA users that are on the move.
http://us.click.yahoo.com/dCBVZC/WnCFAA/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/ 



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux