join_basic.phpt 985 B

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. Test join() function : basic functionality
  3. --FILE--
  4. <?php
  5. echo "*** Testing join() : basic functionality ***\n";
  6. // Initialize all required variables
  7. $glue = ',';
  8. $pieces = array(1, 2, 3, 4);
  9. // pieces as array with numeric values
  10. var_dump( join($glue, $pieces) );
  11. // pieces as array with strings values
  12. $glue = ", "; // multiple car as glue
  13. $pieces = array("Red", "Green", "Blue", "Black", "White");
  14. var_dump( join($glue, $pieces) );
  15. // pieces as associative array (numeric values)
  16. $pieces = array("Hour" => 10, "Minute" => 20, "Second" => 40);
  17. $glue = ':';
  18. var_dump( join($glue, $pieces) );
  19. // pieces as associative array (string/numeric values)
  20. $pieces = array("Day" => 'Friday', "Month" => "September", "Year" => 2007);
  21. $glue = '/';
  22. var_dump( join($glue, $pieces) );
  23. echo "Done\n";
  24. ?>
  25. --EXPECT--
  26. *** Testing join() : basic functionality ***
  27. string(7) "1,2,3,4"
  28. string(30) "Red, Green, Blue, Black, White"
  29. string(8) "10:20:40"
  30. string(21) "Friday/September/2007"
  31. Done