RyanFox Posted August 19, 2014 Share Posted August 19, 2014 Hello, I have multiple str_replace with file_put_contents in my script and it only seems to run the last str_replace. If I remove the last one it runs the first one fine. Code: $file_name = "txt.txt"; $contents = file_get_contents($file_name); //first $updom = str_replace("google.com",$domain,$contents); file_put_contents($file_name, $updom); //last $upip = str_replace("74.125.226.110",$ip,$contents); file_put_contents($file_name, $upip); google.com and that ip are just for testing. If I run that the ip one works but not the domain one, if I comment out the IP one the domain one works fine... What is going on? Thanks, Ryan Link to comment https://forums.phpfreaks.com/topic/290533-multiple-str_replace-in-php-script-not-working/ Share on other sites More sharing options...
RyanFox Posted August 19, 2014 Author Share Posted August 19, 2014 Never mind, I have fixed it. Thanks. Link to comment https://forums.phpfreaks.com/topic/290533-multiple-str_replace-in-php-script-not-working/#findComment-1488287 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.