Re: Recursive Array Iterator
| From: | Gerard Samuel | Date: | Tue, 18 Jan 2005 23:23:03 +0000 |
| Subject: | Re: Recursive Array Iterator | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-206720@lists.php.net to get a copy of this message | ||
Gerard Samuel wrote:
Im trying to figure out how to create this. But Im stuck in the foreach loop. For some reason, $value in the foreach loop is not an object (Isn't is supposed to be?) Any hints to get me in the right direction. Thanks $array = array(1 => array(2 => array(3 => array(4)))); class recursiveArrayIterator extends ArrayIterator implements RecursiveIterator { function __construct($array) {Never mind. I figured it out...parent::__construct( $array );} function hasChildren() { } function getChildren() { } } $obj = new recursiveArrayIterator( $array ); //reflectionObject::export($obj); foreach($obj as $value) { var_dump($value); }