note 40418 deleted from function.file by nlopess

From: Date: Wed, 03 Mar 2004 17:48:08 +0000
Subject: note 40418 deleted from function.file by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-66202@lists.php.net to get a copy of this message
Note Submitter: php@ligthert.net ---- The following code fetches a logfile and puts everything in a array. This code snipet was originally designed to parse squidlog file format, but could easyly serve others. -- /* No need to limit this script */ set_time_limit(0); /* Lets open the logfile an put it an array. */ $logfile = file("/var/squid/logs/access.log"); $i = 0; /* Line for Line, replace dubbelspaces with nothing and put the array from the explode in an array. */ foreach ($logfile as $line) { $line = ereg_replace(" ","",$line); $logarray[$i] = explode(" ",$line); $i++; } -- Enjoy

« previous php.notes (#66202) next »