• 0

Some help with str_replace(); ?


Question

ok, this is my problem.

In the $file i have only one line and that it :

something.txt|something.php|nokia|nokia7210|siemens-SL45|nokia5110|nokia9010i

$fp = file($file);
$text = explode( '|', $fp[0] );

$fp = fopen($file, "r");
$content = fread ($fp, filesize ($file));
fclose ($fp);

$name = "pioneer";
$new = str_replace($text[2], $name, $content);

Now when i use this code above, it replaces everything with the name "nokia" to pioneer.

All i want it to do, is just to replace the $text[2] text to $name.

Not every "nokia" word..

something.txt|something.php|pioneer|pioneer7210|siemens-SL45|pioneer5110|pioneer9010i

plz help. Tnx in advance

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.