Annotation of embedaddon/php/ext/standard/tests/strings/join_variation4.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test join() function : usage variations - different values for 'glue' argument
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : string join( string $glue, array $pieces )
                      6:  * Description: Join array elements with a string
                      7:  * Source code: ext/standard/string.c
                      8:  * Alias of function: implode()
                      9: */
                     10: 
                     11: /*
                     12:  * test join() by passing different glue arguments
                     13: */
                     14: 
                     15: echo "*** Testing join() : usage variations ***\n";
                     16: 
                     17: $glues = array (
                     18:   "TRUE",
                     19:   true,
                     20:   false,
                     21:   array("key1", "key2"),
                     22:   "",
                     23:   " ",
                     24:   "string\x00between",
                     25:   -1.566599999999999,
                     26:   NULL,
                     27:   -0,
                     28:   '\0'
                     29: );
                     30: 
                     31: $pieces = array (
                     32:   2,
                     33:   0,
                     34:   -639,
                     35:   -1.3444,
                     36:   true,
                     37:   "PHP",
                     38:   false,
                     39:   NULL,
                     40:   "",
                     41:   " ",
                     42:   6999.99999999,
                     43:   "string\x00with\x00...\0"
                     44: );
                     45: /* loop through  each element of $glues and call join */
                     46: $counter = 1;
                     47: for($index = 0; $index < count($glues); $index ++) {
                     48:   echo "-- Iteration $counter --\n";
                     49:   var_dump( join($glues[$index], $pieces) );
                     50:   $counter++;
                     51: }
                     52: 
                     53: echo "Done\n";
                     54: ?>
                     55: --EXPECTF--
                     56: *** Testing join() : usage variations ***
                     57: -- Iteration 1 --
                     58: string(91) "2TRUE0TRUE-639TRUE-1.3444TRUE1TRUEPHPTRUETRUETRUETRUE TRUE6999.99999999TRUEstringwith..."
                     59: -- Iteration 2 --
                     60: string(58) "2101-6391-1.3444111PHP1111 16999.999999991stringwith..."
                     61: -- Iteration 3 --
                     62: string(47) "20-639-1.34441PHP 6999.99999999stringwith..."
                     63: -- Iteration 4 --
                     64: 
                     65: Notice: Array to string conversion in %s on line %d
                     66: string(13) "key1Arraykey2"
                     67: -- Iteration 5 --
                     68: string(47) "20-639-1.34441PHP 6999.99999999stringwith..."
                     69: -- Iteration 6 --
                     70: string(58) "2 0 -639 -1.3444 1 PHP      6999.99999999 stringwith..."
                     71: -- Iteration 7 --
                     72: string(201) "2stringbetween0stringbetween-639stringbetween-1.3444stringbetween1stringbetweenPHPstringbetweenstringbetweenstringbetweenstringbetween stringbetween6999.99999999stringbetweenstringwith..."
                     73: -- Iteration 8 --
                     74: string(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..."
                     75: -- Iteration 9 --
                     76: string(47) "20-639-1.34441PHP 6999.99999999stringwith..."
                     77: -- Iteration 10 --
                     78: string(58) "2000-6390-1.3444010PHP0000 06999.999999990stringwith..."
                     79: -- Iteration 11 --
                     80: string(69) "2\00\0-639\0-1.3444\01\0PHP\0\0\0\0 \06999.99999999\0stringwith..."
                     81: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>