Search code examples
phpfilesystemsdirectory

Scan current folder using PHP


I have a folder structure like this:

/articles
     .index.php
     .second.php
     .third.php
     .fourth.php

If I'm writing my code in second.php, how can I scan the current folder(articles)?

Thanks


Solution

  • $files = glob(dirname(__FILE__) . "/*.php");
    

    http://php.net/manual/en/function.glob.php