preg_replace insert newline

From: Date: Wed, 02 Jun 2010 21:28:47 +0000
Subject: preg_replace insert newline
Groups: php.general 
Request: Send a blank email to php-general+get-305760@lists.php.net to get a copy of this message
$string = 'text with no newline'; $pattern = '/(.*)/'; $replacement = '${1}XX\nNext line'; $string = preg_replace($pattern, $replacement, $string); echo $string; Outputs: text with no newlineXX\nNext line Instead of: text with no newlineXX Next line How does one insert a newline with preg_replace? Thanks

« previous php.general (#305760) next »