Created
August 16, 2011 13:49
-
-
Save fixlr/1149122 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class FooThing | |
{ | |
var $message = 'foo'; | |
function to_s() { | |
return $message; | |
} | |
function __toString() { | |
return $message; | |
} | |
} | |
$foo = new FooThing(); | |
echo $foo->to_s(); // prints "message" | |
('foo' == $foo->to_s()) // evaluates true | |
echo $foo; // prints "message" | |
('foo' == $foo) // evaluates false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment