Home » » scandir

scandir

Written By 1 on Sunday, September 30, 2012 | 6:58 PM

array scandir ( string $directory [, int $sorting_order = SCANDIR_SORT_ASCENDING [, resource $context ]] )

List files and directories inside the specified path

Returns an array of files and directories from the directory.


<?php
$dir    
'/tmp';
$files1 scandir($dir);
$files2 scandir($dir1);

print_r($files1);
print_r($files2);
?>

5.4.0 sorting_order constants were added. Any nonzero value caused descending order in previous versions. So for all PHP versions, use 0 for ascending order, and 1 for descending order. An option for SCANDIR_SORT_NONE behavior did not exist prior to PHP 5.4.0.


Curso basico de php 38 - upload scandir() unlink() -

0 Comment:

Post a Comment