summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/join_basic.phpt
blob: 129f75bc7948204b090e557cf67522ee881020af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--TEST--
Test join() function : basic functionality
--FILE--
<?php
echo "*** Testing join() : basic functionality ***\n";

// Initialize all required variables
$glue = ',';
$pieces = array(1, 2, 3, 4);

// pieces as array with numeric values
var_dump( join($glue, $pieces) );

// pieces as array with strings values
$glue = ", "; // multiple car as glue
$pieces = array("Red", "Green", "Blue", "Black", "White");
var_dump( join($glue, $pieces) );

// pieces as associative array (numeric values)
$pieces = array("Hour" => 10, "Minute" => 20, "Second" => 40);
$glue = ':';
var_dump( join($glue, $pieces) );

// pieces as associative array (string/numeric values)
$pieces = array("Day" => 'Friday', "Month" => "September", "Year" => 2007);
$glue = '/';
var_dump( join($glue, $pieces) );

echo "Done\n";
?>
--EXPECT--
*** Testing join() : basic functionality ***
string(7) "1,2,3,4"
string(30) "Red, Green, Blue, Black, White"
string(8) "10:20:40"
string(21) "Friday/September/2007"
Done