note 53300 rejected from function.simplexml-load-file by danbrown

From: Date: Thu, 24 Jul 2008 13:33:11 +0000
Subject: note 53300 rejected from function.simplexml-load-file by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142659@lists.php.net to get a copy of this message
Note Submitter: aleshru at gmail dot com ---- I've got function to convert SimpleXmlObject's to array. <?php function object2array ( $object ) { if ( !is_object ( $object ) ) return $object; $return = array (); $var = get_object_vars ( $object ); while ( list ( $k, $v ) = each ( $var ) ) $return [ $k ] = object2array ( $v ); return $return; } class dummy{ var $a = 1; var $b = 2; var $c = 3; function __construct(){ $this->d = new dummy2(); } } class dummy2{ function __construct(){ $this->e = 'f'; $this->true = true; $this->false = false; $this->null = null; $this->file = __FILE__; } } $object = new dummy; $arr = object2array($object); echo "<pre>"; print_r($arr); echo "</pre>"; ?>

« previous php.notes (#142659) next »