Q. on ereg_replace

From: Date: Tue, 11 Feb 2003 10:52:21 +0000
Subject: Q. on ereg_replace
Groups: php.general 
Request: Send a blank email to php-general+get-135181@lists.php.net to get a copy of this message
i'm creating sort of a very simple css-alike-thing for outputting html to flash actionscript. the php gets a string ($text) from the database, which look something like: <h1>header 1 </h1> etc... then, from a 'css' file it reads the strings $replace and $replacement it looks something like: $number = count($arr_replace); $i = 0; do { $replace = stripcslashes($arr_replace[$i]); $replacement = stripcslashes($arr_replace[$i]); $text = ereg_replace($replace, $replacement, $text); $i++; } while ($i < $number); this works fine, except that after the ereg_replace some newlines are inserted. I could strip them, but then i'm also stripping the original newlines (which were in the string already) so, i'd be happier finding a way of using this script without ereg_replace inserting newline (i don't understand why it does anyway) any suggestions?

« previous php.general (#135181) next »