1--TEST--
2Test closedir() function : basic functionality
3--FILE--
4<?php
5/* Prototype  : void closedir([resource $dir_handle])
6 * Description: Close directory connection identified by the dir_handle
7 * Source code: ext/standard/dir.c
8 * Alias to functions: close
9 */
10
11/*
12 * Test basic functionality of closedir()
13 */
14
15echo "*** Testing closedir() : basic functionality ***\n";
16
17$base_dir = __DIR__;
18$dir_path = $base_dir . '/closedir_basic';
19mkdir($dir_path);
20
21echo "\n-- Call closedir() with no arguments: --\n";
22$dh1 = opendir($dir_path);
23var_dump(closedir());
24echo "-- Check Directory Handle: --\n";
25var_dump($dh1);
26
27echo "\n-- Call closedir() with \$dir_handle argument supplied: --\n";
28$dh2 = opendir($dir_path);
29
30if ((int)$dh1 === (int)$dh2) {
31	echo "\nNo new resource created\n";
32}
33var_dump(closedir($dh2));
34echo "-- Check Directory Handle: --\n";
35var_dump($dh2);
36?>
37===DONE===
38--CLEAN--
39<?php
40$base_dir = __DIR__;
41$dir_path = $base_dir . '/closedir_basic';
42rmdir($dir_path);
43?>
44--EXPECTF--
45*** Testing closedir() : basic functionality ***
46
47-- Call closedir() with no arguments: --
48NULL
49-- Check Directory Handle: --
50resource(%d) of type (Unknown)
51
52-- Call closedir() with $dir_handle argument supplied: --
53NULL
54-- Check Directory Handle: --
55resource(%d) of type (Unknown)
56===DONE===
57