Example #1
0
function mydir($dir, $space)
{
    $handler = opendir($dir);
    while ($tmp = readdir($handler)) {
        if (is_file("{$dir}/{$tmp}")) {
            echo "{$space}<a href='{$dir}/{$tmp}'>{$tmp}</a><br>";
        } else {
            if ($tmp == "." || $tmp == ".." || $tmp == ".git") {
                continue;
            }
            echo "<blockquote><b>{$tmp}</b><br>";
            mydir("{$dir}/{$tmp}", $space);
            echo "</blockquote>";
        }
    }
}
Example #2
0
<?php

/*Написать функцию, которая выводит список файлов в заданной директории, которые содержат искомое слово. Директория и искомое слово задаются как параметры функции.*/
function mydir($dir, $search)
{
    foreach (scandir($dir) as $index => $item) {
        if (preg_match("/{$search}/i", $item)) {
            echo $item . "<br>";
        }
    }
}
mydir("D:/xampp/htdocs/homework/functions_forms_tasks/again", 'php');
Example #3
0
        $cell .= "</td>";
        if ($lastCell != $cell) {
            $content .= str_replace("%%", $colspan, $lastCell);
            $colspan = 0;
        }
        $lastCell = $cell;
    }
    $content .= str_replace("%%", $colspan + 1, $lastCell);
    $content .= "</tr>";
}
// Adding sums:
$content .= "<tr class=\"rev\"><td><b>Failures</b></td>";
foreach ($revs as $rev) {
    $content .= "<td><b>" . $failures[$rev] . "</b></td>";
}
$content .= "</tr>";
$content .= "<tr class=\"rev\"><td><b>Errors</b></td>";
foreach ($revs as $rev) {
    $content .= "<td><b>" . $errors[$rev] . "</b></td>";
}
$content .= "</tr>";
$content .= "</table>";
$title = "The <a href=\"" . mydir() . "?" . add_options() . "\">recent {$maxrevs}</a> tests";
if ($lastrev != "") {
    $title .= " (not later than [{$lastrev}])";
}
if ($firstrev != "") {
    $title .= " (not earlier than [{$firstrev}])";
}
content($title, $content);
$db = null;