1--TEST-- 2Test opendir() function : usage variations - open a directory twice 3--FILE-- 4<?php 5/* Prototype : mixed opendir(string $path[, resource $context]) 6 * Description: Open a directory and return a dir_handle 7 * Source code: ext/standard/dir.c 8 */ 9 10/* 11 * Call opendir() twice with the same directory as $path argument 12 */ 13 14echo "*** Testing opendir() : usage variation ***\n"; 15 16$path = dirname(__FILE__) . "/opendir_variation3"; 17mkdir($path); 18 19echo "\n-- Open directory first time: --\n"; 20var_dump($dh1 = opendir($path)); 21 22echo "\n-- Open directory second time: --\n"; 23var_dump($dh2 = opendir($path)); 24 25if ($dh1 !== $dh2) { 26 echo "\nNew resource created\n"; 27} else { 28 echo "\nNo new resource created\n"; 29} 30 31closedir($dh1); 32closedir($dh2); 33?> 34===DONE=== 35--CLEAN-- 36<?php 37$path = dirname(__FILE__) . "/opendir_variation3"; 38rmdir($path); 39?> 40--EXPECTF-- 41*** Testing opendir() : usage variation *** 42 43-- Open directory first time: -- 44resource(%d) of type (stream) 45 46-- Open directory second time: -- 47resource(%d) of type (stream) 48 49New resource created 50===DONE=== 51