Home / Uncategorized / How to get the current directory listing in PHP

HowToPlaza Earn money writing

How to get the current directory listing in PHP

by Sarah Watts

In PHP if you want to list the files existing in the current directory, this is how you do it:

<?php
$dir=getcwd();
$dirhandle=opendir($dir);
while(false!==($thisfile=readdir($dirhandle)))
{
    print $thisfile . “<br />”;
}



Related posts

  • No Related Post
blog comments powered by Disqus

Previous post:

Next post: