In PHP5, PHP7 it is easier to find the name of files. We are having the function using which we can find the names of the files under a specific folder. You can use the:
$dir = ‘C:/xampp/htdocs/phpSupport/questions/doctopdf/’; //path of the directory
$files2 = scandir($dir, 1);
print_r($files2);
?>
Using the above code to find any extension file under a specific folder.
One more thing in the linux environment you will see the dot parameters. You can remove those using the below code:
<?php
$directory = ‘C:/xampp/htdocs/phpSupport/questions/doctopdf/’;
$scanned_directory = array_diff(scandir($directory), array(‘..’, ‘.’));
?>
Leave a comment