#23312 [NEW]: using objects as primitives (new magic function)
| From: | webmaster at s0nix dot de | Date: | Wed, 23 Apr 2003 07:18:16 +0000 |
| Subject: | #23312 [NEW]: using objects as primitives (new magic function) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-38130@lists.php.net to get a copy of this message | ||
From: webmaster at s0nix dot de
Operating system:
PHP version: 5CVS-2003-04-23 (dev)
PHP Bug Type: Feature/Change Request
Bug description: using objects as primitives (new magic function)
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 bug report at http://bugs.php.net/?id=23312&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23312&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23312&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23312&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23312&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23312&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23312&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23312&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23312&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23312&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23312&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23312&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23312&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23312&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23312&r=gnused