stripos_basic1.phpt 1.0 KB

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