Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
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
✍: FYIcenter.com
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
(
[0] => .
[1] => ..
[2] => todo.txt
)
2007-04-23, 7166👍, 0💬
Popular Posts:
When should the register modifier be used? Does it really help? The register modifier hints to the c...
Can JavaScript steal text from your clipboard? It is true, text you last copied for pasting (copy &a...
How To Enter Binary Numbers in SQL Statements? - MySQL FAQs - Introduction to SQL Basics If you want...
How To List All Values of Submitted Fields? - PHP Script Tips - Processing Web Forms If you want lis...
Can you explain steps in function points? Below are the steps in function points: >First Count ILF, ...