I have a database string containing new lines characters (\n) and needed to print it out with no linebreaks -- since it was being printed as a javascript variable. This script does the trick:
$input = trim( preg_replace( '/\s+/', ' ', $input ) );
courtesy: http://www.codingforums.com/showthread.php?t=137009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment