Exemple #1
0
function printFileList($path)
{
    $handle = opendir($path);
    $filename = readdir($handle);
    echo '<ol>';
    while ($filename != false) {
        if (!($filename == "." || $filename == "..")) {
            if (is_dir("{$path}/{$filename}") == true) {
                prnt("<a href=\"Assignment%202.1.php?path={$path}/{$filename}\"><li style=\"color:blue; text-decoration:underline;\"><img src=\"folder.gif\">{$filename}</li></a>");
            } else {
                prnt("<li>{$filename}</li>");
            }
        }
        $filename = readdir($handle);
    }
    prnt('</ol>');
    closedir($handle);
}
Exemple #2
0
        // single line comment
        if (false) {
            // do something false
            include_once 'MOO';
        } else {
            // do something true
        }
    }
    protected function meow($param, $paeamt)
    {
        foreach ([] as $k => $v) {
            echo $v;
        }
        foreach ([] as $x => $y) {
            echo $y;
        }
        switch (true) {
            case 1:
                break;
            case 0:
                break;
            default:
        }
    }
}
$src = new Ketwaroo\PhpParser\Source(file_get_contents(__FILE__));
foreach ($src->getBlocks() as $TYPE => $blocks) {
    foreach ($blocks as $b) {
        prnt("{$TYPE} {$b}");
    }
}