I am trying to search an array but my search string is invalid. And I expect it to be, but don’t know how to correct it.
Here is a working example that I used:
<?php
$a=array("a"=>"Dog","b"=>"Cat");
echo array_search("Dog",$a);
?>
And here is how I need it to work for my purpose:
[code]<?php
$a=array(“234”=>“Dog_2_2”);
$x = (“2”);
$y = (“2”);
$key = array_search(’$dog’, $a);
$dog = “Dog_” . $x . “_” . $y ;
print $key; //this doesn’t
print $dog; //this works
?>[/code]
How do I make $dog a valid search string? So that when I search for it will return the number. Thank you!