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 NULL, 21 -0, 22 '\0' 23); 24 25$pieces = array ( 26 2, 27 0, 28 -639, 29 -1.3444, 30 true, 31 "PHP", 32 false, 33 NULL, 34 "", 35 " ", 36 6999.99999999, 37 "string\x00with\x00...\0" 38); 39/* loop through each element of $glues and call join */ 40$counter = 1; 41for($index = 0; $index < count($glues); $index ++) { 42 echo "-- Iteration $counter --\n"; 43 try { 44 var_dump(join($glues[$index], $pieces)); 45 } catch (TypeError $exception) { 46 echo $exception->getMessage() . "\n"; 47 } 48 $counter++; 49} 50 51echo "Done\n"; 52?> 53--EXPECT-- 54*** Testing join() : usage variations *** 55-- Iteration 1 -- 56string(91) "2TRUE0TRUE-639TRUE-1.3444TRUE1TRUEPHPTRUETRUETRUETRUE TRUE6999.99999999TRUEstringwith..." 57-- Iteration 2 -- 58string(58) "2101-6391-1.3444111PHP1111 16999.999999991stringwith..." 59-- Iteration 3 -- 60string(47) "20-639-1.34441PHP 6999.99999999stringwith..." 61-- Iteration 4 -- 62join(): Argument #1 ($separator) must be of type string, array given 63-- Iteration 5 -- 64string(47) "20-639-1.34441PHP 6999.99999999stringwith..." 65-- Iteration 6 -- 66string(58) "2 0 -639 -1.3444 1 PHP 6999.99999999 stringwith..." 67-- Iteration 7 -- 68string(201) "2stringbetween0stringbetween-639stringbetween-1.3444stringbetween1stringbetweenPHPstringbetweenstringbetweenstringbetweenstringbetween stringbetween6999.99999999stringbetweenstringwith..." 69-- Iteration 8 -- 70string(124) "2-1.56660-1.5666-639-1.5666-1.3444-1.56661-1.5666PHP-1.5666-1.5666-1.5666-1.5666 -1.56666999.99999999-1.5666stringwith..." 71-- Iteration 9 -- 72string(47) "20-639-1.34441PHP 6999.99999999stringwith..." 73-- Iteration 10 -- 74string(58) "2000-6390-1.3444010PHP0000 06999.999999990stringwith..." 75-- Iteration 11 -- 76string(69) "2\00\0-639\0-1.3444\01\0PHP\0\0\0\0 \06999.99999999\0stringwith..." 77Done 78