Re: hook cast_object handler in userspace

From: Date: Sat, 02 Aug 2003 23:00:10 +0000
Subject: Re: hook cast_object handler in userspace
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-3698@lists.php.net to get a copy of this message
Sorry guys, > $o = new xxx(); should be $o = new my_object(); And if there is a way to hook into zend_standard_class (stdClass) what would make all objects inherit the to_string method, it would be great ! Cristiano Duarte "Cristiano Duarte" <cunha17@uol.com.br> escreveu na mensagem news:20030802224959.58552.qmail@pb1.pair.com... > Hi internals, > > Is there a way to hook the cast_object handler in userspace ? What I want is > a default "to_string" method called when I do something like: > > class my_object extends class_with_default_to_string_method { > private $value = "Hello"; > public function to_string() { //overhiding default to_string wich prints > "Object id #n" > return $this->value; > } > } > > $o = new my_object(); > echo $o; > > or: > > $o = new xxx(); > echo "My stringfied value is=$o"; > > Thanx, > > Cristiano Duarte > >

« previous php.internals (#3698) next »