Consider an array like this,
$sports = array('Football','cricket ball','tennis ball','shuttle bat','hockey stick');
I want to create an array from $sports like this,
$ball = array('Football','cricket ball','tennis ball');
based on the search key(here it is 'ball').
If am looping through the array $sports and checking one by one, will get the result. But then am already inside a loop and that may be even loops more than 50,000 times. So thought of avoiding another loop.
Is there any other way to get this done?
Thanks
array_filter()+preg_match()