1--TEST-- 2Test join() function : usage variations - different values for 'glue' argument 3--FILE-- 4<?php 5/* 6 * test join() by passing different glue arguments 7*/ 8 9echo "*** Testing join() : usage variations ***\n"; 10 11$glues = array ( 12 "TRUE", 13 true, 14 false, 15 array("key1", "key2"), 16 "", 17 " ", 18 "string\x00between", 19 -1.566599999999999, 20 -0, 21 '\0' 22); 23 24$pieces = array ( 25 2, 26 0, 27 -639, 28 -1.3444, 29 true, 30 "PHP", 31 false, 32 "", 33 " ", 34 6999.99999999, 35 "string\x00with\x00...\0" 36); 37/* loop through each element of $glues and call join */ 38$counter = 1; 39for($index = 0; $index < count($glues); $index ++) { 40 echo "-- Iteration $counter --\n"; 41 try { 42 var_dump(join($glues[$index], $pieces)); 43 } catch (TypeError $exception) { 44 echo $exception->getMessage() . "\n"; 45 } 46 $counter++; 47} 48 49echo "Done\n"; 50?> 51--EXPECTF-- 52*** Testing join() : usage variations *** 53-- Iteration 1 -- 54string(87) "2TRUE0TRUE-639TRUE-1.3444TRUE1TRUEPHPTRUETRUETRUE TRUE6999.99999999TRUEstring%0with%0...%0" 55-- Iteration 2 -- 56string(57) "2101-6391-1.3444111PHP111 16999.999999991string%0with%0...%0" 57-- Iteration 3 -- 58string(47) "20-639-1.34441PHP 6999.99999999string%0with%0...%0" 59-- Iteration 4 -- 60join(): Argument #1 ($separator) must be of type string, array given 61-- Iteration 5 -- 62string(47) "20-639-1.34441PHP 6999.99999999string%0with%0...%0" 63-- Iteration 6 -- 64string(57) "2 0 -639 -1.3444 1 PHP 6999.99999999 string%0with%0...%0" 65-- Iteration 7 -- 66string(187) "2string%0between0string%0between-639string%0between-1.3444string%0between1string%0betweenPHPstring%0betweenstring%0betweenstring%0between string%0between6999.99999999string%0betweenstring%0with%0...%0" 67-- Iteration 8 -- 68string(117) "2-1.56660-1.5666-639-1.5666-1.3444-1.56661-1.5666PHP-1.5666-1.5666-1.5666 -1.56666999.99999999-1.5666string%0with%0...%0" 69-- Iteration 9 -- 70string(57) "2000-6390-1.3444010PHP000 06999.999999990string%0with%0...%0" 71-- Iteration 10 -- 72string(67) "2\00\0-639\0-1.3444\01\0PHP\0\0\0 \06999.99999999\0string%0with%0...%0" 73Done 74