TS>>If $a is an object of a class, then they would both be in the class TS>>definition. One is called "add", and the other is called "operator+". What's TS>>the problem with that?
The problem is that you can't really know what $a is - PHP is typeless. You'll have to trace all the program up to $a's assignment and hope you didn't miss reassignment on the way. TS>>It would if operator overloading was allowed on free functions (as it is in TS>>C++). E..g: You can't do it like in C++, because in C++ function signature includes argument types, and in PHP it does not. I.e., you can't write two operators - one for complex+int and one for complex+complex. In general, it's too much trouble for too little gain - except for select things like complex and matrices (and maybe two more things like this) I don't see any value in having, say, + overloaded. Using good old methods will never fail you. -- Stanislav Malyshev, Zend Products Engineer [EMAIL PROTECTED] http://www.zend.com/ +972-3-6139665 ext.115 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php