View the step-by-step solution to:

<?

help this file
<?php function read_dir_content($parent_dir, $depth = 0){ $str_result = ""; $str_result .= "<li>". dirname($parent_dir) ."</li>"; $str_result .= "<ul>"; if ($handle = opendir($parent_dir)) { while (false !== ($file = readdir($handle))) { if(in_array($file, array('.', '. .'))) continue; if( is_dir($parent_dir . "/" . $file) ){ $str_result .= "<li>" . read_dir_content($parent_dir . "/" . $file, $depth++) . "</li>"; } $str_result .= "<li>{$file}</li>"; } closedir($handle); } $str_result .= "</ul>"; return $str_result; } //echo dirname(__FILE__); echo "<ul>".read_dir_content(dirname(__FILE__))."</ul>"; ?>
Background image of page 1

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question