RE: [PHP] removing lines from array

From: Date: Mon, 23 Jul 2001 06:38:19 +0000
Subject: RE: [PHP] removing lines from array
Groups: php.general 
Request: Send a blank email to php-general+get-59132@lists.php.net to get a copy of this message
<? $recordsarray = file ("../auto/records"); $remove = "schopf.net "; while(list($i, $line) = each($recordsarray)) { if(ereg($remove, $line)) { unset($recordsarray[$i]); } } $newFileContent = implode('', $recordsarray); ?> > -----Original Message----- > From: Richard Kurth [mailto:rkurth@pacifier.com] > Sent: 23 iulie 2001 02:36 > To: php > Subject: [PHP] removing lines from array > > > > I an trying to figure out how to remove lines from a text file from > within an array. > > I fill the array with this > > > The lines I what to remove have this in them > > > 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:rkurth@www.north > westhost.com:10800:3600:604800:86400 - > > > > > > > > > > > > Best regards, > Richard > mailto:rkurth@pacifier.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > >

« previous php.general (#59132) next »