note 111039 deleted from arrayobject.getarraycopy by danbrown
| From: | danbrown@php.net | Date: | Thu, 17 Jan 2013 15:19:37 +0000 |
| Subject: | note 111039 deleted from arrayobject.getarraycopy by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193132@lists.php.net to get a copy of this message | ||
Note Submitter: james at rodenkirch dot com
----
Made a small change to your code. The param in the method was never used.
/**
* method to recursively convert ArrayObject to array
*
* @return array
*/
public function getArray() {
$data = array_map( function($item){
if (is_object($item)) {
return $item->getArray(true);
} else {
return $item;
}
}, $this->getArrayCopy() );
return $data;
}