cyphix
11-06-2004, 04:34 PM
I just did up this little script to trim whitespace from the start & end of each line in a file plus some extra stuff but when I downloaded the new text file off my server & opened it, it still had the whitespace @ the start & end of the lines.
Any help?
Here is the code:
<?php
$time = time();
$file = file('database.txt');
$newfile = "**************";
foreach ($file as $val) {
trim($val);
if (strpos($val, "(DC)") == false) {
$insert = fopen($newfile, "a");
fputs($insert, $val);
fclose($insert);
}
}
$newtime = time();
$ftime = $newtime - $time;
echo "<b>Done in $ftime seconds!</b>";
?>
Any help?
Here is the code:
<?php
$time = time();
$file = file('database.txt');
$newfile = "**************";
foreach ($file as $val) {
trim($val);
if (strpos($val, "(DC)") == false) {
$insert = fopen($newfile, "a");
fputs($insert, $val);
fclose($insert);
}
}
$newtime = time();
$ftime = $newtime - $time;
echo "<b>Done in $ftime seconds!</b>";
?>