logo       

Re: Testing the existance of a value in an array: msg#00237

php.tcphp

Subject: Re: Testing the existance of a value in an array

Benjamin,

Do you have the zend optimizer installed and if so did you upgrade it
the last time that you updated your php installation? Also try
upgrading your php installation to the latest release and also
reinstalling your opimizer if you have one.

That may help. I remember a while back I was having some big problems
with arrays not really working correctly and some extra data being
inserted into the array.

Mike

> And I've used in_array, array_search and a quick custom function
> (replicating in_array's functionality) and the behavior is consistent
> between functions, but still is not what is desired (or logical).
>
> PHP Version 4.3.8
>
> I have an array called $filter:
>
> Array
> (
> [0] => oid
> [1] => app_edit_field_id
> )
>
> and the in_array is returning screwy values:
>
> var_dump(in_array("oid",$filter));
> bool(false)
> var_dump(in_array("app_edit_field_id",$filter));
> bool(true)
>
> Compare to using a different filter array:
> Array
> (
> [0] => oid
> [1] => app_edit_field_id
> [2] => oid
> )
>
> var_dump(in_array("oid",$filter));
> bool(true)
> var_dump(in_array("app_edit_field_id",$filter));
> bool(false)
> Lets try reversing the original array:
> Array
> (
> [0] => app_edit_field_id
> [1] => oid
> )
>
> var_dump(in_array("oid",$filter));
> bool(true)
> var_dump(in_array("app_edit_field_id",$filter));
> bool(false)
>
>
> Just to be sure, lets try another array containing different values:
>
> Array
> (
> [0] => table_name
> [1] => user_group
> )
> var_dump(in_array("table_name",$filter));
> bool(false)
> var_dump(in_array("user_group",$filter));
> bool(true)
>
> Does this make any sense to anyone?
> This seems horribly illogical! Any input would be greatly appreciated.

---------------------------------------------------------------------
To unsubscribe, e-mail: talk-unsubscribe-4zcLI8jJc/rYtjvyW6yDsg@xxxxxxxxxxxxxxxx

Please read and follow the list guidelines:
http://www.tcphp.org/mailing_list/guidelines

The tcphp.org mailing list is sponsored by pajunas interactive, inc.




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise