I have an array like below
$array =array(
"123,456,789"=> "1,1,1",
"333"=>"1",
"777"=>"1"
)
Now if I am searching 456 then need to return me array key(123,456,789) and its value (1,1,1)
I also tried like below to make it working but i didn't get success.I need like if i am searching with any value of array key like (123 or 456 or 789) then need to provide me same result. I know that i can achieve this using foreach loop but i don't want to create foreach loop for this so suggest me if any other solution exists.
$matching_key = preg_grep("/\b456\b/", $array);
Sorry but I am not much good in regular expression.
Ideas? Any suggestions?