3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = "This is a string with spaces, tabs and newlines present"; $stripped = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $str); echo $str; echo "\n---\n"; echo "$stripped"; $var = 123; echo "Value of variable \$var";
based on dWvjD
Output for 4.3.0 - 7.2.0
This is a string with spaces, tabs and newlines present --- This is a string with spaces, tabs and newlines presentValue of variable $var