Re: How do I start at a specific position in an array? Is there

From: Date: Mon, 10 Jan 2005 16:28:43 +0000
Subject: Re: How do I start at a specific position in an array? Is there
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-205970@lists.php.net to get a copy of this message
Thomas Goyne wrote: > On Sun, 09 Jan 2005 15:59:43 +0100, M. Sokolewicz <tularis@php.net> wrote: > >> that's not a SPECIFIC place in the array, that's just current, next and >> previous. AFAIK there is no way to explicitly set the internal pointer >> of the array to a spcified place. I used a function which basically >> looped trough the array until it got to the correct depth, and then >> returned it by reference....but it's not very efficient :S >> > > Why would you ever want to do that other than to waste cycles? 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. See also: http://bugs.php.net/bug.php?id=31375 -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#205970) next »