{Spam?} Re: [PHP] Anyone using SPL Iterators?
| From: | Kevin Waterson | Date: | Tue, 21 Sep 2004 21:34:18 +0000 |
| Subject: | {Spam?} Re: [PHP] Anyone using SPL Iterators? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-197489@lists.php.net to get a copy of this message | ||
This one time, at band camp, "John Holmes" <holmes072000@charter.net> wrote:
> Is anyone using SPL iterators out there? Any examples you'd like to share
> that you find useful? Iterating through databases or large files, etc? Just
> curious what people are using this for before I write some stuff myself. :)
I am using them in the current script I am writing (thumbnail generator).
Basically just getting a directory listing and iterating through the array
of filenames and if its an image file, generate a thumbnail. This is my
first foray into them.
I have found a bug in the array iterator through using count(). This
causes a segfault. Have been poking through the source to find the
problem, but no joy yet.
This sort of thing causes a segfault. Assume ArrayReloded implements iterator
as in the tutorial you pointed to.
// Create iterator object
$critters = new ArrayReloaded(array ('dingo','wombat','koala',));
// echo the size of the array
echo $critters->count();
Kind regards
Kevin
---------
"Democracy is two wolves and a lamb voting on what to have for lunch.
Liberty is a well-armed lamb contesting the vote."