Re: PHP 5.1 - operator overloading
| From: | Stanislav Malyshev | Date: | Sun, 06 Feb 2005 09:42:20 +0000 |
| Subject: | Re: PHP 5.1 - operator overloading | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-14654@lists.php.net to get a copy of this message | ||
TS>>An advantage of function objects in C++ is that they can be used where
TS>>functions are expected. Nevertheless, there are some features that can be
Depending on what you mean of "expected". You can't use such object as a
function pointer, for example. Yes, you can write Object() and make that
do Object->operator(). In PHP that won't work, because $object() already
has meaning.
TS>>used to get something similar, such as create_function():
create_function is entirely different thing. It actually dynamically
creates a function (which C++ can't do) which you can call by name. __call
handler is much more like - though not entirely - to the operator()
concept.
--
Stanislav Malyshev, Zend Products Engineer
stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115