1--TEST--
2Test closedir() function : basic functionality
3--FILE--
4<?php
5/*
6 * Test basic functionality of closedir()
7 */
8
9echo "*** Testing closedir() : basic functionality ***\n";
10
11$base_dir = __DIR__;
12$dir_path = $base_dir . '/closedir_basic';
13mkdir($dir_path);
14
15echo "\n-- Call closedir() with no arguments: --\n";
16$dh1 = opendir($dir_path);
17var_dump(closedir());
18echo "-- Check Directory Handle: --\n";
19var_dump($dh1);
20
21echo "\n-- Call closedir() with \$dir_handle argument supplied: --\n";
22$dh2 = opendir($dir_path);
23
24if ((int)$dh1 === (int)$dh2) {
25    echo "\nNo new resource created\n";
26}
27var_dump(closedir($dh2));
28echo "-- Check Directory Handle: --\n";
29var_dump($dh2);
30?>
31--CLEAN--
32<?php
33$base_dir = __DIR__;
34$dir_path = $base_dir . '/closedir_basic';
35rmdir($dir_path);
36?>
37--EXPECTF--
38*** Testing closedir() : basic functionality ***
39
40-- Call closedir() with no arguments: --
41NULL
42-- Check Directory Handle: --
43resource(%d) of type (Unknown)
44
45-- Call closedir() with $dir_handle argument supplied: --
46NULL
47-- Check Directory Handle: --
48resource(%d) of type (Unknown)
49