3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function StripExtraSpace($s) { $newstr = ""; for($i = 0; $i < strlen($s); $i++) { $newstr = $newstr . substr($s, $i, 1); if(substr($s, $i, 1) == ' ') while(substr($s, $i + 1, 1) == ' ') $i++; } return $newstr; }
Output for 4.3.0 - 7.2.0