PHP5: hook cast_object handler in userspace

From: Date: Sat, 02 Aug 2003 22:50:01 +0000
Subject: PHP5: hook cast_object handler in userspace
Groups: php.internals 
Request: Send a blank email to internals+get-3697@lists.php.net to get a copy of this message
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 (#3697) next »