Source Code:
(back to article)
<?php $regex = '/[\s\r\n]+/'; $string = "This is a string\nwith multiple\r\nline breaks."; $new_string = preg_replace($regex, '_', $string); echo $new_string;
Result:
Report an issue