fnmatch_basic.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Test fnmatch() function: Basic functionality
  3. --SKIPIF--
  4. <?php
  5. if (!function_exists('fnmatch'))
  6. die("skip fnmatch() function is not available");
  7. ?>
  8. --FILE--
  9. <?php
  10. /* Prototype: bool fnmatch ( string $pattern, string $string [, int $flags] )
  11. Description: fnmatch() checks if the passed string would match
  12. the given shell wildcard pattern.
  13. */
  14. echo "*** Testing fnmatch() with file ***\n";
  15. $file = basename(__FILE__);
  16. var_dump( fnmatch("*.php", $file) );
  17. var_dump( fnmatch("*.p*p", $file) );
  18. var_dump( fnmatch("*.p*", $file) );
  19. var_dump( fnmatch("*", $file) );
  20. var_dump( fnmatch("**", $file) );
  21. var_dump( fnmatch("*.phpt", $file) );
  22. echo "*** Testing fnmatch() with other than file ***\n";
  23. var_dump( fnmatch(100, 100) );
  24. var_dump( fnmatch("string", "string") );
  25. var_dump( fnmatch(TRUE, TRUE) );
  26. var_dump( fnmatch(FALSE, FALSE) );
  27. var_dump( fnmatch(NULL, NULL) );
  28. echo "\n*** Done ***\n";
  29. ?>
  30. --EXPECT--
  31. *** Testing fnmatch() with file ***
  32. bool(true)
  33. bool(true)
  34. bool(true)
  35. bool(true)
  36. bool(true)
  37. bool(false)
  38. *** Testing fnmatch() with other than file ***
  39. bool(true)
  40. bool(true)
  41. bool(true)
  42. bool(true)
  43. bool(true)
  44. *** Done ***