Jeena Paradies: str_replace in array

Beitrag lesen

Hallo,

$path = "path/to/file.txt";

$lines = file($path);
for($i = 0; $i < count($lines); $i++) {
  $lines[$i] = str_replace("a", "b");
}
file_put_contents($path, $lines);

  
Ah hehe und schon einen Fehler gefunden, `$lines[$i] = str_replace("a", "b", $lines[$i]);`{:.language-php} hätte es sein soll.  
  
   Jeena  
![](http://jeenaparadies.net/pavatar.png)

-- 
[Jlog](http://jeenaparadies.net/webdesign/jlog/) | [Gourmetica Mentiri](http://jeenaparadies.net/gourmetica-mentiri/)