3v4l.org

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

preferences:
53.45 ms | 402 KiB | 5 Q