- print_r: documentation ( source)
- stripos: documentation ( source)
<?php
$array = array(
'Bob' => 2,
'Theresa' => 3,
'The farm house' => 2,
'Bob at the farm house' => 1,
);
$result = $array;
$removed = &$result;
foreach($removed as $key => $value) {
foreach($removed as $test => $value) {
if (false !== stripos($test, $key)) {
unset($removed[$test]);
}
}
}
print_r($result);