$text = $_POST['text'];
//1 replace hard spaces with spaces
$text = str_replace(' ', ' ', $text);
//2 squeeze spaces
$text = preg_replace('/\s+/', ' ', $text);
//replace "> " & " <" with ">" & "<" respectively
$result = str_replace(array('> ', ' <'), array('>', '<'), $text);
Editor is loading...