3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 'Bob' => 2, 'Theresa' => 3, 'The farm house' => 2, 'Bob at the farm house' => 1, ); $result = $array; $removed = $result; foreach($result as $key => $value) { foreach($result as $test => $value) { if (false !== stripos($test, $key)) { unset($result[$key]); } } } print_r($result);

preferences:
37.03 ms | 402 KiB | 5 Q