Re: [PHP4BETA] ereg_replace update

From: Date: Tue, 17 Aug 1999 23:11:36 +0000
Subject: Re: [PHP4BETA] ereg_replace update
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-3529@lists.php.net to get a copy of this message
George Hartz wrote: > > Okay, my bad. Pulled a new CVS tree, the ereg_replace coredump has been > fixed. > > But -- the problem with the use of an integer as a string still happens > in PHP4. > > I don't want to file a bug on it before I know it actually IS a bug. > > Actually it seems to work differently from PHP3 now too... > > Basically, as I said in my other e-mail, this is the sample code: > > <?php > $number = 1000; > $string = "/something/%s/"; > $string = ereg_replace("\%s", $number, $string); > > print "<H1>$string</H1>\n"; > ?> > > In PHP3, I get /something/1000/ as the output unless $number is less > than 256, then I seem to get /something/*/ where * is the character > represented by the ascii value of $number. In PHP4, I get an "è" (sorry hmm, I'm not a guru or rx :) but afaik % doesn't have to be escaped. So basically it replaces % w/ your number so, do you get /something/\134s/ out? where \134 (134 is at random) is an escape sequence for a char(so a weird one). try ereg_replace("%s",$number,"/string/%s/"); and see what happens -- CIMPOESU Teodor, Web Programmer (h) @ DIGICOM S.A. Bucharest, Romania @ Internet, site development @ teo@digiro.net, +(401)-330.47.28 official home page ~ http://www.digiro.net/ Internet web page ~ http://internet.digiro.net/

« previous php.version4 (#3529) next »