Andrei Zmievski wrote:
>
> On Tue, 20 Feb 2001, Stig Venaas wrote:
> > I could in order to save the position do $key = key($arr). To
> > restore it later, I could then do something like array_setpos($key).
> > I'm not sure if the Zend API allows for setting the position without
> > looping throu
On Tue, 20 Feb 2001, Stig Venaas wrote:
> I could in order to save the position do $key = key($arr). To
> restore it later, I could then do something like array_setpos($key).
> I'm not sure if the Zend API allows for setting the position without
> looping through the array though. If array_setpos(
On Tue, Feb 20, 2001 at 08:27:59AM -0600, Andrei Zmievski wrote:
> in_array() used to move the pointer to the entry found, but people
> complained about it so I remove it... :)
And I thought it was neat, can't please everyone I guess (:
There seems to be a general problem with array functions an
On Tue, 20 Feb 2001, Stig Venaas wrote:
> Not quite sure we need array_find(). If we can have in_array() set
> the array pointer to point to the entry found, one can get the key
> by using key(). If in_array() also searches from the pointer onwards,
> one can find all entries with the value by doi
On Mon, Feb 19, 2001 at 12:02:48PM -0600, Andrei Zmievski wrote:
> On Mon, 19 Feb 2001, Jason Greene wrote:
> > > We can change in_array() to return the the key if it's found, and false
> > > if it's not, but imagine all the scripts it would break..
> > about 1/4th of mine : )
> >
> > Well I thin
> Could be done. The way I'd do it is have one php_in_array() C function
> that gets parameters passed through from in_array() and array_find() as
> well as a flag indicating whether to just return true/false or the
> actual key.
what about not touching the internal pointer? there in_array would
anghorst" <[EMAIL PROTECTED]>; "PHP Development" <[EMAIL PROTECTED]>
Sent: Monday, February 19, 2001 12:02 PM
Subject: Re: [PHP-DEV] PHP 4.0 Bug #9337 Updated: make in_array return key, if
searched value was found
> On Mon, 19 Feb 2001, Jason Greene wrote:
> > >
On Mon, 19 Feb 2001, Jason Greene wrote:
> > We can change in_array() to return the the key if it's found, and false
> > if it's not, but imagine all the scripts it would break..
> about 1/4th of mine : )
>
> Well I think the basic problem is that people are using in_array against its
>intention
reene" <[EMAIL PROTECTED]>
Cc: "André Langhorst" <[EMAIL PROTECTED]>; "PHP Development" <[EMAIL PROTECTED]>
Sent: Monday, February 19, 2001 11:50 AM
Subject: Re: [PHP-DEV] PHP 4.0 Bug #9337 Updated: make in_array return key, if
searched value was found
On Mon, 19 Feb 2001, Jason Greene wrote:
> Some of my thoughts:
> 1. if you change the return value of in_array to return the key, you can get a false
>error
> in your if statement, imagine if in_array found the element in key 0? : )
> 2. I would say that returning a key is a bit more useful then
-
From: "Andrei Zmievski" <[EMAIL PROTECTED]>
To: "André Langhorst" <[EMAIL PROTECTED]>
Cc: "PHP Development" <[EMAIL PROTECTED]>
Sent: Monday, February 19, 2001 11:36 AM
Subject: Re: [PHP-DEV] PHP 4.0 Bug #9337 Updated: make in_array return key, if
On Mon, 19 Feb 2001, André Langhorst wrote:
> > How about using array_keys($array, $value) to find the key?
>
> obviously it is cheaper to let in_array return it and it is more php 4
> stylish, we have booleans, why not use them?
>
> if ($key=in_array()) do_someting_with_key($key);
So, you sug
> How about using array_keys($array, $value) to find the key?
obviously it is cheaper to let in_array return it and it is more php 4
stylish, we have booleans, why not use them?
if ($key=in_array()) do_someting_with_key($key);
is less expensive than
if (in_array()) {
$key=array_keys($arra
How about using array_keys($array, $value) to find the key?
On Mon, 19 Feb 2001, [EMAIL PROTECTED] wrote:
> ID: 9337
> Updated by: andre
> Reported By: [EMAIL PROTECTED]
> Old-Status: Open
> Status: Feedback
> Bug Type: Feature/Change Request
> Assigned To:
> Comments:
>
> maybe a fourth parame
14 matches
Mail list logo