NYCPHP Meetup

[nycphp-talk] EREG Question

Chris Snyder chris at psydeshow.org
Wed Feb 5 10:57:28 EST 2003


Chris Shiflett wrote:

>--- "Pete Czech - New Possibilities Group, LLC" 
>  
>
>>   foreach($number as $n) {
>>    
>>
>
>Add an echo statement right here that displays the current
>value of $n. I think you will find that your problem comes
>sooner than you think.
>
>  
>
>>    if ($n == $a) {
>>     $content = ereg_replace("$a", "<b>$a</b>",
>>$content);  //<------ PROBLEM AREA!!!
>>     $correct_amount++;
>>    }  
>>   }
>>    
>>
And also, why not just use the simpler str_replace()?
http://www.php.net/manual/en/function.str-replace.php

Then you don't have to worry about the regex failing. I think it's 
quicker, too?

    chris.

-- 
HIP HOP CLOWN MONTH
booth of the day: all day, every day
http://hiphopclown.org/berylium/showcase/





More information about the talk mailing list