Help with file read

From: Date: Sun, 19 May 2002 10:21:15 +0000
Subject: Help with file read
Groups: php.general 
Request: Send a blank email to php-general+get-98356@lists.php.net to get a copy of this message
Can someone look and help I have a function that returns the date in this format [10/Apr/2002:01:17:27 +1000] but I'm having trouble returning the last date in the file. $totalhits = count($fcontents); $filename = ("combined_log"); //open file $fcontents = file($filename); //read into array //print_r($fcontents); $limit = 1; for ($i = 0; $i < $limit; $i++) //loop { $line = $fcontents[$i]; if (!empty($line)) { $currentdate = getmydate($line); //call function that returns first date. This is OK $currentdate = substr($currentdate, 1); $currentdate= substr_replace($currentdate, " ", -15); echo "First day of access " .$currentdate; $lastdate = getmydate($fcontents[count($fcontents)-1]); //**************This is returning nothing? $lastdate = substr($lastdate, 1); $lastdate= substr_replace($lastdate, " ", -15); echo "<br>Last day of access " .$lastdate; } }

« previous php.general (#98356) next »