PHP Question

by 3 replies
4
Okay I'm confused. I got this error message:
Warning: Wrong parameter count for str_replace() in /home/deannatr/public_html/jobs/jobs2_0/config.php on line 10 when I was trying to code my site.

This is the line where the error is:
$show_url=str_replace("http://jobs.learnsmallbusiness.com/jobs_2_0",$site_url);

I can't figure out what the error is! Can you please help me? I'm still trying to learn how to code in php. Thanks.
#programming #php #question
  • The error is just what it says, it's looking for more parameters than what you're providing. Here's the manual for str_replace. It's a search and replace function and requires the string you want to replace, the string to search for, and the string to replace it with.

    For example:

    $OLD_STRING= "Hello world!";
    $SEARCH = "world";
    $REPLACE = "warriors";

    $OLD_STRING = str_replace( $SEARCH, $REPLACE, $OLD_STRING );

    echo $OLD_STRING; // Hello world!
    echo $NEW_STRING; // Hello warriors!

    Hope that helps -- I could help you with your specific problem, but I can't tell exactly what you want to replace with what in what.
    • [1] reply
    • Thanks for your answer. Can I pm you the original code?
  • Okay I think I understand what's going on, now. I had to read that twice. Thanks for your help.

Next Topics on Trending Feed

  • 4

    Okay I'm confused. I got this error message: Warning: Wrong parameter count for str_replace() in /home/deannatr/public_html/jobs/jobs2_0/config.php on line 10 when I was trying to code my site.