note 107557 deleted from language.types.object by danbrown

From: Date: Thu, 10 May 2012 20:45:25 +0000
Subject: note 107557 deleted from language.types.object by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-187834@lists.php.net to get a copy of this message
Note Submitter: nekwave at gmail dot com ---- to: contact at mullanaphy dot com 02-Mar-2011 01:26 protected function object_to_array($Class) { # Typecast to (array) automatically converts stdClass -> array. $Class = (array)$Class; # Iterate through the former properties looking for any stdClass properties. # Recursively apply (array). foreach($Class as $key => $value){ if(is_object($value)&&get_class($value)=='stdClass'){ $Class[$key] = self::objectToArray($value); } else { if (is_array($value)) { $Class[$key] = self::objectToArray($value); } } } return $Class; } most correct

« previous php.notes (#187834) next »