FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Reference # in var_dump output?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Reference # in var_dump output? [message #169518] Thu, 16 September 2010 15:14 Go to next message
matt[1] is currently offline  matt[1]
Messages: 40
Registered: September 2010
Karma: 0
Member
Hi. Quick question: I'm comparing two stdClass objects and getting
an unexpected inequality--nonidenticality? Is there a word for the
state of !== returning true? As far as I can tell, all the members
are identical. There is one difference between the two in a var_dump
output, but I'm not sure if that should make PHP consider the two to
be nonidentical:

object(stdClass)#15013 (17) {
^^^^^
...[all the same here]...
}

object(stdClass)#15252 (17) {
^^^^^
...[all the same here]...
}

Literally, the only difference is what follows the # sign. I am
assuming that's some kind of reference id or something, but perhaps
I'm mistaken. Could that be what's making this errantly pass a !==
check?
Re: Reference # in var_dump output? [message #169519 is a reply to message #169518] Thu, 16 September 2010 15:20 Go to previous message
matt[1] is currently offline  matt[1]
Messages: 40
Registered: September 2010
Karma: 0
Member
On Sep 16, 11:14 am, matt <matthew.leonha...@gmail.com> wrote:
> Hi.  Quick question:  I'm comparing two stdClass objects and getting
> an unexpected inequality--nonidenticality?  Is there a word for the
> state of !== returning true?  As far as I can tell, all the members
> are identical. There is one difference between the two in a var_dump
> output, but I'm not sure if that should make PHP consider the two to
> be nonidentical:
>
> object(stdClass)#15013 (17) {
>                  ^^^^^
>   ...[all the same here]...
>
> }
>
> object(stdClass)#15252 (17) {
>                  ^^^^^
>   ...[all the same here]...
>
> }
>
> Literally, the only difference is what follows the # sign.  I am
> assuming that's some kind of reference id or something, but perhaps
> I'm mistaken.  Could that be what's making this errantly pass a !==
> check?

Whoops. Disregard. Didn't realize they had to be references to the
same instance to pass ===. Guess I'll have to use == for the check.

ref: http://php.net/manual/en/language.oop5.object-comparison.php

Two instances of the same class
o1 == o2 : TRUE
o1 != o2 : FALSE
o1 === o2 : FALSE
o1 !== o2 : TRUE
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: echo other way to output a constant?
Next Topic: Best PHP way to connect to a DB across multiple pages ?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 20:11:45 GMT 2024

Total time taken to generate the page: 0.02482 seconds