Re: Casting objects.

From: Date: Mon, 18 Jan 2010 16:51:53 +0000
Subject: Re: Casting objects.
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-301200@lists.php.net to get a copy of this message
Shawn McKenzie wrote: >> > Never mind, that was stupid. I saw that somewhere before, but obviously > it doesn't work. > I found some code, maybe I redeem myself? static public function cast(&$object, $class=__CLASS__){ if(class_exists($class)) { $object = unserialize( preg_replace('/^O:[0-9]+:"[^"]+":/i', 'O:'.strlen($class).':"'.$class.'":', serialize($object))); } } $row = odbc_fetch_object($result); structuresRemovalReason::cast($row); -- Thanks! -Shawn http://www.spidean.com

« previous php.general (#301200) next »