What is wrong with my script. Worked fine on previous version of PHP and now doesn't sinc the upgrade. Here's my code:
<?php
$filename = 'pidlist.txt';
$lines = file($filename);
foreach($lines as $line) {$new_lines .= str_replace(' ',';',$line)."";}
$handle = fopen($filename,"w");
fwrite($handle,$new_lines);
fclose($handle);
?>
I get the error message:
PHP Notice: Undefined variable: new_lines in /var/lib/pgsql/tidpid/nospacespid.php on line 8
It partially works, but puts in random blank rows in my txt file.
Any Ideas?