Re: Q. on ereg_replace

From: Date: Tue, 11 Feb 2003 12:09:35 +0000
Subject: Re: Q. on ereg_replace
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-135186@lists.php.net to get a copy of this message
never mind it i've solved it trimming the $replace and $replacement before using them in ereg_replace() thanks anyway "Michiel Van Heusden" <michiel@aemulatio.nl> wrote in message news:20030211105444.61667.qmail@pb1.pair.com... > 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 (#135186) next »