note 56691 added to function.simplexml-load-file

From: Date: Mon, 12 Sep 2005 18:06:10 +0000
Subject: note 56691 added to function.simplexml-load-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-95062@lists.php.net to get a copy of this message
If the property of an object is empty the array is not created. Here is a version object2array that transfers properly. 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] = ($key && !$value) ? NULL : object2array($value); } else return $object; } return $return; } ---- Manual Page -- http://www.php.net/manual/en/function.simplexml-load-file.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56691 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56691&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56691&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56691&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56691&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56691&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56691&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56691&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#95062) next »