note 105625 deleted from language.types.object by danbrown
| From: | danbrown@php.net | Date: | Thu, 01 Sep 2011 20:25:24 +0000 |
| Subject: | note 105625 deleted from language.types.object by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182889@lists.php.net to get a copy of this message | ||
Note Submitter: jaimz at vertigolabs dot org
----
@arnold at jasny dot net:
That's not unexpected, that should be completely expected.
Lets take a look:
<?php
$foo = "something";
// at this point $foo is a string
$bar = (object)$foo;
// at this point $bar is an object that contains a property named scalar that is equal to
"something"
var_dump($foo == $bar); // Outputs "bool(false)"
// var_dump outputs the result of the expression, since $foo is a string, and $bar is an object
they should not be equal.
// maybe this is what you were looking for ?
var_dump((object)$foo == $bar); // Outputs "bool(true)"
?>