Anonymous Anonymous - 1 year ago 246
PHP Question

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

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

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