Re: Re: Array Search - Solved
| From: | Ethan Rosenberg | Date: | Sun, 27 Mar 2011 01:50:56 +0000 |
| Subject: | Re: Re: Array Search - Solved | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-312074@lists.php.net to get a copy of this message | ||
At 01:31 PM 3/25/2011, João Cândido de Souza Neto wrote:
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
++++++++++++
Thank you. It works!!
Ethan
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php