ID: 23312 Updated by: [EMAIL PROTECTED] Reported By: webmaster at s0nix dot de -Status: Open +Status: Wont fix Bug Type: Feature/Change Request PHP Version: 5CVS-2003-04-23 (dev) New Comment:
No more magic, please. Previous Comments: ------------------------------------------------------------------------ [2004-04-14 22:55:11] jevon at jevon dot org Doesn't __toString() do this already? (Although __toString()) is broken at the moment.) But along the same lines, how about a __toNumber() for arithmetic? ------------------------------------------------------------------------ [2003-04-23 02:18:15] webmaster at s0nix dot de http://www.zend.com/phorum/read.php?num=6&id=668&loc=0&thread=668 [quote] First, object representation in different contexts. Currently, if we write: echo $object; PHP produce not much of information about instance: 'object'. I have read many articles about new PHP5 features where I found note that we will be able to use an object in a 'foreach' instruction, like an array, if this object implement container interface. This is great - I think about an another usage of this concept - using an object as a string. For example, if class provide an specific method (magic function?): class TSerializable { function __value() { return $this->toXML(); } } we will be able to use it like a simple value - an object will be automatically converted (with a method defined by the user) to a 'primitive' representation: echo '<tag>'.$object.'</tag>'; or <?=$object; ?> This will be very useful - e.g. in serialization, debugging and PHP-based templates because we will be able to use general syntax to streaming simple and complex data. [/quote] ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23312&edit=1
