explode_variation4.phpt 736 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. Test explode() function : usage variations - match longer string
  3. --FILE--
  4. <?php
  5. /* Prototype : array explode ( string $delimiter , string $string [, int $limit ] )
  6. * Description: Split a string by string.
  7. * Source code: ext/standard/string.c
  8. */
  9. echo "*** Testing explode() function: match longer string ***\n";
  10. $pizza = "piece1 piece2 piece3 piece4 piece5 piece6 p";
  11. $pieces = explode(" p", $pizza);
  12. var_dump($pieces);
  13. ?>
  14. ===DONE===
  15. --EXPECT--
  16. *** Testing explode() function: match longer string ***
  17. array(7) {
  18. [0]=>
  19. string(6) "piece1"
  20. [1]=>
  21. string(5) "iece2"
  22. [2]=>
  23. string(5) "iece3"
  24. [3]=>
  25. string(5) "iece4"
  26. [4]=>
  27. string(5) "iece5"
  28. [5]=>
  29. string(5) "iece6"
  30. [6]=>
  31. string(0) ""
  32. }
  33. ===DONE===