Re: Array Search
| From: | Jo�o C�ndido de Souza Neto | Date: | Fri, 25 Mar 2011 17:31:59 +0000 |
| Subject: | Re: Array Search | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-312052@lists.php.net to get a copy of this message | ||
It´s a job to array_key_exists function.
--
João Cândido de Souza Neto
"Ethan Rosenberg" <ethros@earthlink.net> escreveu na mensagem
news:0LIM00HI3IHNYX10@mta4.srv.hcvlny.cv.net...
> Dear List -
>
> Here is a code snippet:
>
> $bla = array("g1" => $results[7][6],
> "h1" => $results[7][7]);
> print_r($bla);
> $value = "h1";
> $locate1 = array_search($value, $bla);
> echo "This is locate" ; print_r($locate1);
> if(in_array($value, $bla)) print_r($bla);
>
> Neither the array_search or the in_array functions give any results. I
> have tried it with both h1 and "h1";
>
> $results[7][6] = Wn;
> $results[7][7] = Wr;
>
> This is a chess board where g1 and h1 are the coordinates and the results
> array contains the pieces at that coordinate.
>
> What am I doing wrong?
>
> Advice and comments please.
>
> Thanks.
>
> Ethan Rosenberg
>