3v4l.org

run code in 300+ PHP versions simultaneously
<?php function strInArray($haystack, $needle) { $i = 0; foreach ($haystack as $value) { $result = stripos($value,$needle); if ($result !== FALSE) return TRUE; $i++; } return FALSE; } $array = array(12,43,66,21,56,43,43,78,78,100,43,43,43,21); for ($i = 0; $i < count($array); $i++) { if (strInArray($array,$array[$i])) { unset($array[$i]); } } var_dump($array);

preferences:
17.4 ms | 402 KiB | 5 Q