1--TEST--
2Test scandir() function : usage variations - different ints as $sorting_order arg
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 * Pass different integers as $sorting_order argument to test how scandir()
12 * re-orders the array
13 */
14
15echo "*** Testing scandir() : usage variations ***\n";
16
17// include for create_files/delete_files functions
18include(dirname(__FILE__) . '/../file/file.inc');
19
20// create directory and files
21$dir = dirname(__FILE__) . '/scandir_variation9';
22mkdir($dir);
23@create_files($dir, 2);
24
25// different ints to pass as $sorting_order argument
26$ints = array (PHP_INT_MAX, -PHP_INT_MAX, 0);
27
28foreach($ints as $sorting_order) {
29	var_dump( scandir($dir, $sorting_order) );
30}
31
32delete_files($dir, 2);
33?>
34===DONE===
35--CLEAN--
36<?php
37$dir = dirname(__FILE__) . '/scandir_variation9';
38rmdir($dir);
39?>
40--EXPECTF--
41*** Testing scandir() : usage variations ***
42array(4) {
43  [0]=>
44  string(9) "file2.tmp"
45  [1]=>
46  string(9) "file1.tmp"
47  [2]=>
48  string(2) ".."
49  [3]=>
50  string(1) "."
51}
52array(4) {
53  [0]=>
54  string(9) "file2.tmp"
55  [1]=>
56  string(9) "file1.tmp"
57  [2]=>
58  string(2) ".."
59  [3]=>
60  string(1) "."
61}
62array(4) {
63  [0]=>
64  string(1) "."
65  [1]=>
66  string(2) ".."
67  [2]=>
68  string(9) "file1.tmp"
69  [3]=>
70  string(9) "file2.tmp"
71}
72===DONE===
73