php how to replace many space with one space
$str = preg_replace('/\s+/', ' ', $str); //" \n\n\n" will end up as " \n"
$str = preg_replace('/\x20+/', ' ', $str); //only space
$str = preg_replace('/\s+/', ' ', $str); //" \n\n\n" will end up as " \n"
$str = preg_replace('/\x20+/', ' ', $str); //only space