12 maj 2008

Generowanie listy plików dla katalogu

$dir = "/pliki/";

if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if($file=='.' || $file=='..') continue;
         $file_list .= $file.'", "'.$dir . $file."\n";
        }
        closedir($dh);
    }

    $file_list = substr($file_list, 1);
}

echo $file_list;

12 maj 2008

Obliczanie data

echo date('d F Y', strtotime ("-5 day")), "<br>";
echo date('d F Y', strtotime ("01 Jan 2008")), "<br>";
echo date('d F Y', strtotime ("2008-01-01 +10days")), "<br>";