strrpos_basic1.phpt 965 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. Test strrpos() function : basic functionality - with default arguments
  3. --FILE--
  4. <?php
  5. echo "*** Testing strrpos() function: basic functionality ***\n";
  6. $heredoc_str = <<<EOD
  7. Hello, World
  8. EOD;
  9. echo "-- With default arguments --\n";
  10. //regular string for haystack & needle
  11. var_dump( strrpos("Hello, World", "Hello") );
  12. var_dump( strrpos('Hello, World', "hello") );
  13. var_dump( strrpos("Hello, World", 'World') );
  14. var_dump( strrpos('Hello, World', 'WORLD') );
  15. //single char for needle
  16. var_dump( strrpos("Hello, World", "o") );
  17. var_dump( strrpos("Hello, World", ",") );
  18. //heredoc string for haystack & needle
  19. var_dump( strrpos($heredoc_str, "Hello, World") );
  20. var_dump( strrpos($heredoc_str, 'Hello') );
  21. var_dump( strrpos($heredoc_str, $heredoc_str) );
  22. echo "*** Done ***";
  23. ?>
  24. --EXPECT--
  25. *** Testing strrpos() function: basic functionality ***
  26. -- With default arguments --
  27. int(0)
  28. bool(false)
  29. int(7)
  30. bool(false)
  31. int(8)
  32. int(5)
  33. int(0)
  34. int(0)
  35. int(0)
  36. *** Done ***