Software QA (13)
SQL Server (1)
How To Dump the Contents of a Directory into an Array
How To Dump the Contents of a Directory into an Array? - PHP Script Tips - Working with Directoris and Files
If you want to get the contents of a directory into an array, you can use the scandir() function. It gets a list of all the files and sub directories of the specified directory and returns the list as an array. The returning list also includes two specify entries: (.) and (..). Here is a PHP script example on how to use scandir():
<?php mkdir("/temp/download"); $array["one"] = "Download PHP scripts at dev.fyicenter.com.\r\n"; $array["two"] = "Download Perl scripts at dev.fyicenter.com.\r\n"; $bytes = file_put_contents("/temp/download/todo.txt", $array); $files = scandir("/temp/download"); print_r($files); ?>
This script will print:
Array (  => .  => ..  => todo.txt )
2007-04-23, 6724👍, 0💬
How To Set Background to Transparent or Non-transparent? - CSS Tutorials - HTML Formatting Model: Bl...
How can we suppress a finalize method? GC.SuppressFinalize ()
Have you ever worked with Microsoft Application Blocks, if yes then which? Application Blocks are C#...
What would you use to compare two String variables - the operator == or the method equals()? You can...
How can I include comments in HTML? An HTML comment begins with "<!--", ends with "-->...