Possible Duplicate:
Best way to get files from a dir filtered by certain extension in php
What would be the best way to retrieve file names with a specified extension?
I came up with this solution and it works fine but am wondering if there is a better way.
print_r(array_filter(scandir(dirname(__FILE__)), create_function('$a', 'return (substr($a, -4) == ".php") ? true : false ;')));