3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ "Lincoln Crown", "Crown Court", "go holiday", "house fire", "John Hinton", "Hinton Jailed" ]; $output = []; $blacklist = []; foreach ($input as $string) { $words = explode(' ', $string); foreach ($words as $word) { if (in_array($word, $blacklist)) { continue 2; } } array_push($blacklist, ...$words); $output[] = $string; } var_export($blacklist); echo "\n"; var_export($output);

preferences:
26.54 ms | 407 KiB | 5 Q