import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-strings / join_variation3.php
blobb53e784897f5245061d2a0e8b4e94c6695ed5bc5
1 <?php
2 /* Prototype : string join( string $glue, array $pieces )
3 * Description: Join array elements with a string
4 * Source code: ext/standard/string.c
5 * Alias of function: implode()
6 */
8 /*
9 * test join() by giving different pieces values
12 echo "*** Testing join() : usage variations ***\n";
14 $pieces_arrays = array (
15 array(1, 2), // array with default keys and numrice values
16 array(1.1, 2.2), // array with default keys & float values
17 array( array(2), array(1)), // sub arrays
18 array(false,true), // array with default keys and boolean values
19 array(), // empty array
20 array(NULL), // array with NULL
21 array("a","aaaa","b","bbbb","c","ccccc"),
23 // associative arrays
24 array(1 => "one", 2 => "two", 3 => "three"), // explicit numeric keys, string values
25 array("one" => 1, "two" => 2, "three" => 3 ), // string keys & numeric values
26 array( 1 => 10, 2 => 20, 4 => 40, 3 => 30), // explicit numeric keys and numeric values
27 array( "one" => "ten", "two" => "twenty", "three" => "thirty"), // string key/value
28 array("one" => 1, 2 => "two", 4 => "four"), //mixed
30 // associative array, containing null/empty/boolean values as key/value
31 array(NULL => "NULL", null => "null", "NULL" => NULL, "null" => null),
32 array(true => "true", false => "false", "false" => false, "true" => true),
33 array("" => "emptyd", '' => 'emptys', "emptyd" => "", 'emptys' => ''),
34 array(1 => '', 2 => "", 3 => NULL, 4 => null, 5 => false, 6 => true),
35 array('' => 1, "" => 2, NULL => 3, null => 4, false => 5, true => 6),
37 // array with repetative keys
38 array("One" => 1, "two" => 2, "One" => 10, "two" => 20, "three" => 3)
41 // a multichar glue value
42 $glue = "], [";
44 // loop through each $pieces_arrays element and call join()
45 $iteration = 1;
46 for($index = 0; $index < count($pieces_arrays); $index ++) {
47 echo "-- Iteration $iteration --\n";
48 var_dump( join($glue, $pieces_arrays[$index]) );
49 $iteration ++;
52 echo "Done\n";