strcspn_basic.phpt 650 B

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. Test strcspn() function : basic functionality
  3. --FILE--
  4. <?php
  5. /*
  6. * Testing strcspn() : basic functionality
  7. */
  8. echo "*** Testing strcspn() : basic functionality ***\n";
  9. // Initialise all required variables
  10. $str = "this is the test string";
  11. $mask = "es";
  12. $start = 15;
  13. $len = 3;
  14. // Calling strcspn() with all possible arguments
  15. var_dump( strcspn($str, $mask, $start, $len) );
  16. // Calling strcspn() with three arguments
  17. var_dump( strcspn($str, $mask, $start) );
  18. // Calling strcspn() with default arguments
  19. var_dump( strcspn($str, $mask) );
  20. echo "Done"
  21. ?>
  22. --EXPECT--
  23. *** Testing strcspn() : basic functionality ***
  24. int(2)
  25. int(2)
  26. int(3)
  27. Done