Esempio n. 1
0
function printMonths()
{
    global $months;
    $monthIndex = 0;
    $output = '<li>';
    // print out the calendar structure
    // Loop over each month
    foreach ($months as $month) {
        // print out the month name
        $name = $month[0];
        $days = $month[1];
        $output .= printDays($name, $days);
        ++$monthIndex;
    }
    $output .= '</li>';
    $output .= '</ul>';
    return $output;
}
    if (is_numeric($input)) {
        switch ($input) {
            case '0':
                displayContent('/var/www/html/hw2/file1.txt');
                break;
            case '1':
                displayContent('/var/www/html/hw2/file2.txt');
                break;
            case '2':
                displayContent('/var/www/html/hw2/file3.txt');
                break;
            case '3':
                displayContent('/var/www/html/hw2/file4.txt');
                break;
            case '4':
                printDays($days_of_week);
                break;
            case '5':
                printContentDirectory('/etc/');
                break;
            default:
                echo "\n\t\t\t\t\tThere is an error in input\n\t\t\t\t";
                break;
        }
    } else {
        echo "\n\t\t\tThere is an error in input\n\t\t";
    }
}
function displayContent($file)
{
    $lines = file($file);