Re: RecursiveArrayIterator

From: Date: Mon, 23 Jul 2007 02:30:09 +0000
Subject: Re: RecursiveArrayIterator
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-259351@lists.php.net to get a copy of this message
This is what I have so far.. <?php $array = array( array('name'=>'butch', 'sex'=>'m', 'breed'=>'boxer'), array('name'=>'fido', 'sex'=>'m', 'breed'=>'doberman'), array('name'=>'girly','sex'=>'f', 'breed'=>'poodle') ); $iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($array)); while($iterator->valid()) { if(!$iterator->hasChildren()) { echo $iterator->key().' -- '.$iterator->current().'<br/>'; } $iterator->next(); } ?> Kevin -- "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote."

« previous php.general (#259351) next »