78 lines
2.1 KiB
PHP
78 lines
2.1 KiB
PHP
--TEST--
|
||
Test join() function : usage variations - different values for 'glue' argument
|
||
--FILE--
|
||
<?php
|
||
/*
|
||
* test join() by passing different glue arguments
|
||
*/
|
||
|
||
echo "*** Testing join() : usage variations ***\n";
|
||
|
||
$glues = array (
|
||
"TRUE",
|
||
true,
|
||
false,
|
||
array("key1", "key2"),
|
||
"",
|
||
" ",
|
||
"string\x00between",
|
||
-1.566599999999999,
|
||
NULL,
|
||
-0,
|
||
'\0'
|
||
);
|
||
|
||
$pieces = array (
|
||
2,
|
||
0,
|
||
-639,
|
||
-1.3444,
|
||
true,
|
||
"PHP",
|
||
false,
|
||
NULL,
|
||
"",
|
||
" ",
|
||
6999.99999999,
|
||
"string\x00with\x00...\0"
|
||
);
|
||
/* loop through each element of $glues and call join */
|
||
$counter = 1;
|
||
for($index = 0; $index < count($glues); $index ++) {
|
||
echo "-- Iteration $counter --\n";
|
||
try {
|
||
var_dump(join($glues[$index], $pieces));
|
||
} catch (TypeError $exception) {
|
||
echo $exception->getMessage() . "\n";
|
||
}
|
||
$counter++;
|
||
}
|
||
|
||
echo "Done\n";
|
||
?>
|
||
--EXPECT--
|
||
*** Testing join() : usage variations ***
|
||
-- Iteration 1 --
|
||
string(91) "2TRUE0TRUE-639TRUE-1.3444TRUE1TRUEPHPTRUETRUETRUETRUE TRUE6999.99999999TRUEstring |