Strpos ile döngü () daha iyi bir yöntem var mı?
Kısmi maçları değil, bir İn_Array'in () yöntemini yazmanız için arıyorum değil.
örnek samanlık ve iğne ve istenen dönüş:
$needles[0] = 'naan bread';
$needles[1] = 'cheesestrings';
$needles[2] = 'risotto';
$needles[3] = 'cake';
$haystack[0] = 'bread';
$haystack[1] = 'wine';
$haystack[2] = 'soup';
$haystack[3] = 'cheese';
//desired output - but what's the best method of getting this array?
$matches[0] = 'bread';
$matches[1] = 'cheese';
yani:
magic_function ($ samanlık,% $ iğneler%)!