note 68923 deleted from function.simplexml-load-file by danbrown

From: Date: Thu, 24 Jul 2008 13:29:49 +0000
Subject: note 68923 deleted from function.simplexml-load-file by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142653@lists.php.net to get a copy of this message
Note Submitter: info at tpsoftware dot de ---- The object2array function by joelfielder is very nice but fails for CDATA. Very simple fix: <? function object2array($object) { $return = NULL; if(is_array($object)) { foreach($object as $key => $value) $return[$key] = object2array($value); } else { $var = get_object_vars($object); if($var) { foreach($var as $key => $value) $return[$key] = object2array($value); } else return strval($object); // strval and everything is fine } return $return; } ?>

« previous php.notes (#142653) next »