1--TEST-- 2Test scandir() function : basic functionality 3--FILE-- 4<?php 5/* Prototype : array scandir(string $dir [, int $sorting_order [, resource $context]]) 6 * Description: List files & directories inside the specified path 7 * Source code: ext/standard/dir.c 8 */ 9 10/* 11 * Test basic functionality of scandir() 12 */ 13 14echo "*** Testing scandir() : basic functionality ***\n"; 15 16// include file.inc for create_files function 17include (dirname(__FILE__) . '/../file/file.inc'); 18 19// set up directory 20$directory = dirname(__FILE__) . '/scandir_basic'; 21mkdir($directory); 22create_files($directory, 3); 23 24echo "\n-- scandir() with mandatory arguments --\n"; 25var_dump(scandir($directory)); 26 27echo "\n-- scandir() with all arguments --\n"; 28$sorting_order = 1; 29$context = stream_context_create(); 30var_dump(scandir($directory, $sorting_order, $context)); 31 32delete_files($directory, 3); 33?> 34===DONE=== 35--CLEAN-- 36<?php 37$directory = dirname(__FILE__) . '/scandir_basic'; 38rmdir($directory); 39?> 40--EXPECTF-- 41*** Testing scandir() : basic functionality *** 42 43-- scandir() with mandatory arguments -- 44array(5) { 45 [0]=> 46 string(1) "." 47 [1]=> 48 string(2) ".." 49 [2]=> 50 string(9) "file1.tmp" 51 [3]=> 52 string(9) "file2.tmp" 53 [4]=> 54 string(9) "file3.tmp" 55} 56 57-- scandir() with all arguments -- 58array(5) { 59 [0]=> 60 string(9) "file3.tmp" 61 [1]=> 62 string(9) "file2.tmp" 63 [2]=> 64 string(9) "file1.tmp" 65 [3]=> 66 string(2) ".." 67 [4]=> 68 string(1) "." 69} 70===DONE=== 71