Re: PHP 4.0 Bug #6460 Updated: bug in eregi_replace?¿?
| From: | Angel Ivorra Alfonso | Date: | Fri, 01 Sep 2000 11:03:41 +0000 |
| Subject: | Re: PHP 4.0 Bug #6460 Updated: bug in eregi_replace?¿? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-31557@lists.php.net to get a copy of this message | ||
>
> so, what's the problem there? Could you please cut down your code to shortest reproducing
> script possible and clearly describe what's the problem? Also, before doing this, please check
> 4.0.2.
I didnt put it in the web because is down :(
Here is cleaner code and explanation
<?php
function traduceChar($phrase) {
switch($phrase) {
case "HI": $tmp = "<B>TRADUCED HI</B>"; break;
case "DOS": $tmp = "<B>TRADUCED DOS</B>"; break;
default: $tmp = "<b>$phrase</b> : Error, not in CASE"; break;
}
return $tmp;
}
$cadena="<#HI><BR>
<#DOS><BR>
<#ERROR><BR>
Hi<BR>";
echo eregi_replace( "<#([A-Z]+)>", traduceChar("\\1") ,$cadena );
echo traduceChar("HI") . "<BR>";
echo traduceChar("DOS") . "<BR>";
?>
The result is:
==============
HI : Error, not in CASE
DOS : Error, not in CASE
ERROR : Error, not in CASE
Hi
TRADUCED HI
TRADUCED DOS
The result musd be:
====================
TRADUCED HI
TRADUCED DOS
ERROR : Error, not in CASE
Hi
TRADUCED HI
TRADUCED DOS