note 105625 added to language.types.object
| From: | jaimz at vertigolabs dot org | Date: | Thu, 01 Sep 2011 17:40:47 +0000 |
| Subject: | note 105625 added to language.types.object | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182883@lists.php.net to get a copy of this message | ||
@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)"
?>
----
Server IP: 69.147.83.197
Probable Submitter: 71.79.100.85
----
Manual Page -- http://www.php.net/manual/en/language.types.object.php
Edit -- https://master.php.net/note/edit/105625
Del: integrated -- https://master.php.net/note/delete/105625/integrated
Del: useless -- https://master.php.net/note/delete/105625/useless
Del: bad code -- https://master.php.net/note/delete/105625/bad+code
Del: spam -- https://master.php.net/note/delete/105625/spam
Del: non-english -- https://master.php.net/note/delete/105625/non-english
Del: in docs -- https://master.php.net/note/delete/105625/in+docs
Del: other reasons-- https://master.php.net/note/delete/105625
Reject -- https://master.php.net/note/reject/105625
Search -- https://master.php.net/manage/user-notes.php