1--TEST-- 2Test dirname() function : basic functionality 3--CREDITS-- 4Dave Kelsey <d_kelsey@uk.ibm.com> 5--SKIPIF-- 6<?php 7if(substr(PHP_OS, 0, 3) != "WIN") 8 die("skip Only valid for Windows"); 9?> 10--FILE-- 11<?php 12echo "*** Testing dirname() : basic functionality ***\n"; 13 14 15// Initialise all required variables 16$paths = array( 17 '', 18 ' ', 19 'c:', 20 'c:\\', 21 'c:/', 22 'afile', 23 'c:\test\afile', 24 'c:\\test\\afile', 25 'c://test//afile', 26 'c:\test\afile\\', 27 '/usr/lib/locale/en_US', 28 '//usr/lib//locale/en_US', 29 '\\', 30 '\\\\', 31 '/', 32 '//', 33 '///', 34 '/usr/lib/locale/en_US/', 35 'c:\windows/system32\drivers/etc\hosts', 36 '/usr\lib/locale\en_US', 37 ' c:\test\adir\afile.txt', 38 'c:\test\adir\afile.txt ', 39 ' c:\test\adir\afile.txt ', 40 ' /usr/lib/locale/en_US', 41 '/usr/lib/locale/en_US ', 42 ' /usr/lib/locale/en_US ', 43 ' c:', 44 ' c:\test\adir\afile.txt', 45 '/usr', 46 '/usr/', 47 ); 48 49foreach ($paths as $path) { 50 var_dump( dirname($path) ); 51} 52 53?> 54--EXPECT-- 55*** Testing dirname() : basic functionality *** 56string(0) "" 57string(1) "." 58string(2) "c:" 59string(3) "c:\" 60string(3) "c:\" 61string(1) "." 62string(7) "c:\test" 63string(7) "c:\test" 64string(8) "c://test" 65string(7) "c:\test" 66string(15) "/usr/lib/locale" 67string(17) "//usr/lib//locale" 68string(1) "\" 69string(1) "\" 70string(1) "\" 71string(1) "\" 72string(1) "\" 73string(15) "/usr/lib/locale" 74string(31) "c:\windows/system32\drivers/etc" 75string(15) "/usr\lib/locale" 76string(15) " c:\test\adir" 77string(12) "c:\test\adir" 78string(15) " c:\test\adir" 79string(18) " /usr/lib/locale" 80string(15) "/usr/lib/locale" 81string(18) " /usr/lib/locale" 82string(1) "." 83string(14) " c:\test\adir" 84string(1) "\" 85string(1) "\" 86