pathinfo_variation3.phpt 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. echo "*** Testing pathinfo() : usage variation ***\n";
  13. $testfile = "/usr/include/arpa/inet.h";
  14. var_dump(pathinfo("./"));
  15. var_dump(pathinfo("/."));
  16. var_dump(pathinfo(".cvsignore"));
  17. var_dump(pathinfo($testfile, PATHINFO_BASENAME));
  18. var_dump(pathinfo($testfile, PATHINFO_FILENAME));
  19. var_dump(pathinfo($testfile, PATHINFO_EXTENSION));
  20. var_dump(pathinfo($testfile, PATHINFO_DIRNAME));
  21. var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_FILENAME|PATHINFO_DIRNAME));
  22. var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_FILENAME|PATHINFO_BASENAME));
  23. var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_FILENAME));
  24. var_dump(pathinfo($testfile, PATHINFO_EXTENSION|PATHINFO_BASENAME));
  25. var_dump(pathinfo($testfile, PATHINFO_FILENAME|PATHINFO_DIRNAME));
  26. var_dump(pathinfo($testfile, PATHINFO_FILENAME|PATHINFO_BASENAME));
  27. var_dump(pathinfo($testfile, PATHINFO_DIRNAME|PATHINFO_EXTENSION));
  28. var_dump(pathinfo($testfile, PATHINFO_DIRNAME|PATHINFO_BASENAME));
  29. ?>
  30. ===DONE===
  31. --EXPECTF--
  32. *** Testing pathinfo() : usage variation ***
  33. array(4) {
  34. ["dirname"]=>
  35. string(1) "."
  36. ["basename"]=>
  37. string(1) "."
  38. ["extension"]=>
  39. string(0) ""
  40. ["filename"]=>
  41. string(0) ""
  42. }
  43. array(4) {
  44. ["dirname"]=>
  45. string(1) "%s"
  46. ["basename"]=>
  47. string(1) "."
  48. ["extension"]=>
  49. string(0) ""
  50. ["filename"]=>
  51. string(0) ""
  52. }
  53. array(4) {
  54. ["dirname"]=>
  55. string(1) "."
  56. ["basename"]=>
  57. string(10) ".cvsignore"
  58. ["extension"]=>
  59. string(9) "cvsignore"
  60. ["filename"]=>
  61. string(0) ""
  62. }
  63. string(6) "inet.h"
  64. string(4) "inet"
  65. string(1) "h"
  66. string(17) "/usr/include/arpa"
  67. string(17) "/usr/include/arpa"
  68. string(6) "inet.h"
  69. string(1) "h"
  70. string(6) "inet.h"
  71. string(17) "/usr/include/arpa"
  72. string(6) "inet.h"
  73. string(17) "/usr/include/arpa"
  74. string(17) "/usr/include/arpa"
  75. ===DONE===