Re: [PHP-DEV] preg_grep bug?!?

2001-03-19 Thread Andrei Zmievski

On Mon, 19 Mar 2001, William N. Zanatta wrote:
> Hello ppl,
> 
>  I have a dropdown menu which lists some countries. These countries are
> also in a database and each of them have an ID number used for control.
>  Well, when I insert an entry for each of the countries in the database,
> the next time I click on the dropdown this country must not appear
> again. For this, I use preg_grep($country, $country_list) where
> $country is the current country code and $country_list is the array of
> already known country codes.
>  The problem is(I'm gonna show it by the country codes): I have
>  1, 2, 3, 4...12 countries
>  Then I insert firstly the 12th. When the script executes the preg_grep
> next time I'll get 3, 4...11. Well, it kicked away my 1 and 2 just
> because of 12. 
>  Is this a normal behavior???
>  Sorry for the dazed text and thanx,

Since 4.0.4, preg_grep() returns the entries under keys from the
original array. You might want to try doing array_values() on the
results of preg_grep() to avoid that.

-Andrei
* On the keyboard of life, always keep one finger on the escape key. *

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] preg_grep bug?!?

2001-03-19 Thread William N. Zanatta

Hello ppl,

 I have a dropdown menu which lists some countries. These countries are
also in a database and each of them have an ID number used for control.
 Well, when I insert an entry for each of the countries in the database,
the next time I click on the dropdown this country must not appear
again. For this, I use preg_grep($country, $country_list) where
$country is the current country code and $country_list is the array of
already known country codes.
 The problem is(I'm gonna show it by the country codes): I have
 1, 2, 3, 4...12 countries
 Then I insert firstly the 12th. When the script executes the preg_grep
next time I'll get 3, 4...11. Well, it kicked away my 1 and 2 just
because of 12. 
 Is this a normal behavior???
 Sorry for the dazed text and thanx,

William

-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]