I have made a function to search an array and lookup for values starting by the 2d param :
public static function arrayContainsValueStartingBy($haystack, $needle) {
$len = strlen($needle);
foreach ($haystack as $hay) {
if (substr($hay, 0, $len) == $needle) {
return true;
}
}
return false;
}
I feel like its not as optimized as it can be, could you give me some directions to improve it ?
array_map()