Re: SPL Iterator and Associative Array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jason Karns wrote:
> I'm going to try my best to explain what I'm trying to do.
> 
> I have my own class that has an array member.  This class itself implements
> Iterator.  One of the fields in the array is itself an array that I would
> like to iterate over. Here's some code:
> 
> class Folio implements Iterator {
> $projects = array(
> 	array(
> 		'title'=>"",
> 		'clip'=>"",
> 		'small'=>array('1','2','3')),
> 	array(
> 		'title'=>"",
> 		'clip'=>"",
> 		'small'=>array('0','1','2'))
> );
> function title($x){
> 	return current($this->projects[$]['small']);
                                      ^^
> }
> 
> function smalls($x){
> 	return $this->projects[$x]['small'];
> }
> }

<snip>
Hi Jason,

The code you pasted is littered with fatal errors and bugs (I marked one
example with "^^" above).  Please paste a real batch of code that you've
tested and reproduces the error and that will be much more helpful.  The
PHP version would be helpful to know as well.

Greg

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux