Object Function-call handling in PHP5
| From: | Jake Gardner | Date: | Wed, 28 Sep 2005 14:45:07 +0000 |
| Subject: | Object Function-call handling in PHP5 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-223358@lists.php.net to get a copy of this message | ||
This is a toughy I've been working over for a bit. I was wondering if
there is a way to cause objects to have certain behaviors when builtin
functions are called, or maybe a way of setting, for example, a
"primary" string which is used whenever a function requiring a string
calls it.
IE:
Class myString {
Public $Value;
Function __construct($Value) {
$this->Value = $Value;
}
}
$MyString = new myString("Hello World");
Print($MyString); //Wondering if I can get this to return "Hello World"
Printing is probably a weak example because you could just use
Print($MyString->Value); but there are reasons why I would want it
this way.