On Mon, 2002-05-13 at 19:32, Josh Edwards wrote:
> This is meant to grab a date out of a log file from the first line of the
> array but I'm getting a parse error on line 13. Any ideas?
>
> function getdate($hit)
There is already a PHP function named 'getdate()'; you'll need
another name here.
> {
> $single = explode (" ",$hit);
> return $single[3].$single[4];
> }
>
> $filename = ("combined_log");
>
> fopen ($filename, "r");
fopen() is meaningless here; you don't need to use it with file().
> $fcontents = file($filename);
> $limit = 1;
> for ($i = 0; $i <= $limit; $i++)
> {
> $line = $fcontents[i];
> if ($line! = " ")
The above line should be:
if ($line != " ")
...but you may be better off with
if (!empty($line))
...or...
if (strlen($line) > 0)
...or something like that.
Hope this helps,
Torben
> {
> $currentdate = getdate($line);
> echo $currentdate;
> }
> }
--
Torben Wilson <[EMAIL PROTECTED]>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php