Re: How do I start at a specific position in an array? Is there
| From: | Richard Lynch | Date: | Mon, 10 Jan 2005 20:14:26 +0000 |
| Subject: | Re: How do I start at a specific position in an array? Is there | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-206016@lists.php.net to get a copy of this message | ||
Marek Kilimajer wrote:
> Richard Lynch wrote:
>> I'll give you a simple case.
>>
>> I have a GTK PHP MP3 ID3 editor application I'm working on.
>>
>> When one opens a file in a directory, I provide next/prev buttons to
>> quickly page to the next/prev file in the directory.
>>
>> Getting the next/prev to work is simple enough, but...
>>
>> I've got the whole array built from opendir/readdir, and sorted it into
>> alphabetical order.
>>
>> I've got a filename inside that array, from the pre-defined
>> GtkFileSelection dialog.
>>
>> So I need to initialize the internal array pointer to the position of
>> the
>> file within that array, there is no such PHP function.
>
> for(;;) loop would not work?
Yes, and since the array is "small" it's no big deal -- I already have
that working.
It just would be more clean to have a set_current function to set the
internal array iterator to the correct position.
--
Like Music?
http://l-i-e.com/artists.htm