3v4l.org

run code in 300+ PHP versions simultaneously
<?php $name = 'this has lots of spaces'; $name = preg_replace('/ +/', '_', $name); print $name . PHP_EOL; $name = 'this has lots of spaces'; $name = preg_replace('/\s+/', '_', $name); print $name . PHP_EOL; $name = 'this has one tab and lots of tabs'; $name = preg_replace('/ +/', '_', $name); print $name . PHP_EOL; $name = 'this has one tab and lots of tabs'; $name = preg_replace('/\s+/', '_', $name); print $name . PHP_EOL;

preferences:
35.4 ms | 404 KiB | 5 Q