I'm trying to search an array and return multiple keys
<?php
$a=array("a"=>"1","b"=>"2","c"=>"2");
echo array_search("2",$a);
?>
With the code above it only returns b, how can I get I to return b and c?
As it says in the manual for array_search:
To return the keys for all matching values, use array_keys() with the optional search_value parameter instead.
$a=array("a"=>"1","b"=>"2","c"=>"2");
print_r(array_keys($a, "2"));
Array
(
[0] => b
[1] => c
)