Return to pathinfo_variation3.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / file |
1.1 misho 1: --TEST-- 2: Test pathinfo() function : usage variation 3: --CREDITS-- 4: Dave Kelsey <d_kelsey@uk.ibm.com> 5: --FILE-- 6: <?php 7: /* Prototype : array pathinfo(string path[, int options]) 8: * Description: Returns information about a certain string 9: * Source code: ext/standard/string.c 10: * Alias to functions: 11: */ 12: 13: echo "*** Testing pathinfo() : usage variation ***\n"; 14: 15: $testfile = "/usr/include/arpa/inet.h"; 16: 17: var_dump(pathinfo("./")); 18: var_dump(pathinfo("/.")); 19: var_dump(pathinfo(".cvsignore")); 20: var_dump(pathinfo($testfile, PATHINFO_BASENAME)); 21: var_dump(pathinfo($testfile, PATHINFO_FILENAME)); 22: var_dump(pathinfo($testfile, PATHINFO_EXTENSION)); 23: var_dump(pathinfo($testfile, PATHINFO_DIRNAME)); 24: var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_FILENAME|PATHINFO_DIRNAME)); 25: var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_FILENAME|PATHINFO_BASENAME)); 26: var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_FILENAME)); 27: var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_BASENAME)); 28: var_dump(pathinfo($testfile, PATHINFO_FILENAME|PATHINFO_DIRNAME)); 29: var_dump(pathinfo($testfile, PATHINFO_FILENAME|PATHINFO_BASENAME)); 30: var_dump(pathinfo($testfile, PATHINFO_DIRNAME|PATHINFO_EXTENSION)); 31: var_dump(pathinfo($testfile, PATHINFO_DIRNAME|PATHINFO_BASENAME)); 32: 33: 34: ?> 35: ===DONE=== 36: --EXPECTF-- 37: *** Testing pathinfo() : usage variation *** 38: array(4) { 39: ["dirname"]=> 40: string(1) "." 41: ["basename"]=> 42: string(1) "." 43: ["extension"]=> 44: string(0) "" 45: ["filename"]=> 46: string(0) "" 47: } 48: array(4) { 49: ["dirname"]=> 50: string(1) "%s" 51: ["basename"]=> 52: string(1) "." 53: ["extension"]=> 54: string(0) "" 55: ["filename"]=> 56: string(0) "" 57: } 58: array(4) { 59: ["dirname"]=> 60: string(1) "." 61: ["basename"]=> 62: string(10) ".cvsignore" 63: ["extension"]=> 64: string(9) "cvsignore" 65: ["filename"]=> 66: string(0) "" 67: } 68: string(6) "inet.h" 69: string(4) "inet" 70: string(1) "h" 71: string(17) "/usr/include/arpa" 72: string(17) "/usr/include/arpa" 73: string(6) "inet.h" 74: string(1) "h" 75: string(6) "inet.h" 76: string(17) "/usr/include/arpa" 77: string(6) "inet.h" 78: string(17) "/usr/include/arpa" 79: string(17) "/usr/include/arpa" 80: ===DONE===