Home »
Imported messages »
comp.lang.php »
Reference # in var_dump output?
Re: Reference # in var_dump output? [message #169519 is a reply to message #169518] |
Thu, 16 September 2010 15:20 |
matt[1]
Messages: 40 Registered: September 2010
Karma:
|
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
|
|
|
Goto Forum:
Current Time: Sun Nov 10 17:15:05 GMT 2024
Total time taken to generate the page: 0.05181 seconds