note 107557 added to language.types.object
| From: | nekwave at gmail dot com | Date: | Fri, 17 Feb 2012 10:34:03 +0000 |
| Subject: | note 107557 added to language.types.object | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186187@lists.php.net to get a copy of this message | ||
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
----
Server IP: 69.147.83.197
Probable Submitter: 91.222.223.170
----
Manual Page -- http://www.php.net/manual/en/language.types.object.php
Edit -- https://master.php.net/note/edit/107557
Del: integrated -- https://master.php.net/note/delete/107557/integrated
Del: useless -- https://master.php.net/note/delete/107557/useless
Del: bad code -- https://master.php.net/note/delete/107557/bad+code
Del: spam -- https://master.php.net/note/delete/107557/spam
Del: non-english -- https://master.php.net/note/delete/107557/non-english
Del: in docs -- https://master.php.net/note/delete/107557/in+docs
Del: other reasons-- https://master.php.net/note/delete/107557
Reject -- https://master.php.net/note/reject/107557
Search -- https://master.php.net/manage/user-notes.php