Assignments Home

Assignments Home

Assignments

Research Documentation

Debug Code - Show Results of scandir()


// print_r($assignments_directory_items);
Array
(
    [0] => .
    [1] => ..
    [2] => 01-includes
    [3] => 02-mail
    [4] => 03-thumbnail-upload
    [5] => 04-sessions-mysql
    [6] => index.php
    [7] => x-99-rss
)
// print_r($rd_directory_items);
Array
(
    [0] => .
    [1] => ..
    [2] => 01-php-history.php
    [3] => 02-magic-constants.php
    [4] => index.php
)

$_SERVER["SCRIPT_NAME"]
/php/assignments/index.php

print_r($_GET)
Array
(
)


print_r($_POST)
Array
(
)


print_r($_SESSION)
Array
(
)


print_r($_FILES)
Array
(
)



<?php
$tools 
true// Robert's Custom Variable (Do Not Use)
include("{$_SERVER['DOCUMENT_ROOT']}/php/includes/header.php");
?>
<main>
    <h2><?php echo $folder_name?>
        <span><?php echo $file_name?></span>
    </h2>

    <?php
    $assignments_directory_name 
basename(getcwd());
    
?>
    <h2><?php echo ucwords($assignments_directory_name); ?></h2>

    <ul>
        <?php
        $assignments_directory_items 
scandir(getcwd());
        foreach (
$assignments_directory_items as $item) {
            if (
preg_match('/^[\.]|^[\.\.]|^[x-]|index.php/'$item)) continue;
            echo 
"\t<li><a href=\"/php/{$assignments_directory_name}/{$item}\">{$item}</a></li>\n";
        }
        
?>
    </ul>

    <?php
    chdir
('../research-documentation');
    
$rd_directory_name basename(getcwd());
    
?>
    <h2><?php echo ucwords(str_replace("-"" "$rd_directory_name)); ?></h2>

    <ul>
        <?php
        $rd_directory_items 
scandir(getcwd());
        foreach (
$rd_directory_items as $item) {
            if (
preg_match('/^[\.]|^[\.\.]|^[x-]|index.php/'$item)) continue;
            echo 
"\t<li><a href=\"/php/{$rd_directory_name}/{$item}\">{$item}</a></li>\n";
        }
        
chdir('../assignments');
        
?>
    </ul>

    <h2>Debug Code - Show Results of <a href="https://www.php.net/scandir"><code>scandir()</code></a></h2>
    <pre class="line-numbers">
<code class="language-php">
<?php
echo '// print_r($assignments_directory_items);' "\n";
print_r($assignments_directory_items);

echo 
'// print_r($rd_directory_items);' "\n";
print_r($rd_directory_items);
?>
</code>
</pre>


</main>
<?php
include("{$_SERVER['DOCUMENT_ROOT']}/php/includes/sidebar.php");
include(
"{$_SERVER['DOCUMENT_ROOT']}/php/includes/footer.php");
?>