$recordsarray = file("records");
$remove = "schopf.net";
$temp = array();
for ($i=0;$i<count($recordsarray);$i++)
{
if (!strstr($recordsarray[$i], $remove))
{
$temp[] = $recordsarray[$i];
}
}
$recordsarray = $temp;
$lines = join($recordsarray, '\n');
$fp = fopen("records", "w");
fwrite($fp, $lines, strlen($lines));
fclose($fp);
.
.
//should work
//elias
"Richard Kurth" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> I an trying to figure out how to remove lines from a text file from
> within an array.
>
> I fill the array with this
> $recordsarray = file ("../auto/records");
>
> The lines I what to remove have this in them
> $remove = "schopf.net ";
>
> What I need is how to loop through this array and pull out the lines
> that have what is in the $remove variable.
>
> Then I will write the array to a temp file and thin copy it back to
> the records file
>
>
> This is a small sample of the file I what two remove lines from
> mx - schopf.net High www.schopf.net
> ptr - readinggenius.tv 207.200.75.55 24
> a - time-management-by-higher-productivity.com 207.252.75.55 24
> ptr www speedreading123.com 207.200.75.55 24
> ptr - mindbodyspirit123.com 207.200.75.247 24
> a www schopf.net 207.252.75.242 24
> soa - schopf.net
dns1.northwesthost.com:dns2.northwesthost.com:[EMAIL PROTECTED]:1
0800:3600:604800:86400 -
>
>
>
>
>
>
>
>
>
>
>
> Best regards,
> Richard
> mailto:[EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]