note 102277 modified in function.simplexml-load-string by danbrown

From: Date: Sat, 05 Feb 2011 21:01:23 +0000
Subject: note 102277 modified in function.simplexml-load-string by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-176708@lists.php.net to get a copy of this message
A simpler way to transform the result into an array (requires json module). <?php function object2array($object) { return @json_decode(@json_encode($object),1); } ?> Example: <?php $xml_object=simplexml_load_string('<SOME XML DATA'); $xml_array=object2array($xml_object); ?> --was-- A simpler way to transform the result into an array (requires json module). function object2array($object) { return @json_decode(@json_encode($object),1); } Example: $xml_object=simplexml_load_string('<SOME XML DATA'); $xml_array=object2array($xml_object); http://php.net/manual/en/function.simplexml-load-string.php

« previous php.notes (#176708) next »