ここの行末のNULLを取り除くにはどうすればよいですか?
ワイオミングMIニュージャージー07728コンピューター修理テクヌル
$phrases = array("NEW YORK NY", "NEW JERSEY", "SOUTH DAKOTA", "SOUTH CAROLINA", "COMPUTER REPAIR TECH","YORK NY","07728","WYOMING MI","WYOMING MINNESOTA");
$string = ("I live in wyoming Minnesota, but used to live in New Jersey 07728 working as a computer repair tech.");
$string = strtoupper($string);
$matches = stringSearch($phrases, $string);
var_dump($matches);
function stringSearch($phrases, $string){
$phrases1 = trim(implode('|', $phrases));
$phrases1 = str_replace(' ', '\s', $phrases1);
preg_match_all("/$phrases1/s", $string, $matches);
$value = implode(' ', array_filter($matches[0]));
echo $value;
}