Cytat
mam w pliku fights.txt cos takiego
123||123||123||123||123||123||123||03.09.06 09.03
123||123||123||123||123||123||123||03.09.06 10.12
123||123||123||123||123||123||123||03.09.06 07.04
jakim skryptem odczytac linijke o najswiezszej dacie ?
[php:1:24ae63f365]<?php
$last = 0;
$fd = fopen($plik, 'r');
while (($l = fgets($fd)) !== false)
{
$d = substr(strrchr(chop($l), '|'), 1);
list($data, $czas) = explode(' ', $d);
list($r, $m, $d) = explode('.', $data);
list($h, $mi) = explode('.', $czas);
if (($t = mktime($h, $mi, 0, $d, $m, $r)) > $last)
{
$last = $t;
$ll = $l;
}
}
print $ll
?>[/php:1:24ae63f365]