Array Search

From: Date: Fri, 25 Mar 2011 17:12:51 +0000
Subject: Array Search
Groups: php.general 
Request: Send a blank email to php-general+get-312050@lists.php.net to get a copy of this message
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

« previous php.general (#312050) next »