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

1.1       misho       1: --TEST--
                      2: Test explode() function : usage variations - positive and negative limits
                      3: --FILE--
                      4: <?php
                      5: 
                      6: /* Prototype  : array explode  ( string $delimiter  , string $string  [, int $limit  ] )
                      7:  * Description: Split a string by string.
                      8:  * Source code: ext/standard/string.c
                      9: */
                     10: 
                     11: echo "*** Testing explode() function: positive and negative limits ***\n";
                     12: $str = 'one||two||three||four';
                     13: 
                     14: echo "\n-- positive limit --\n";
                     15: var_dump(explode('||', $str, 2));
                     16: 
                     17: echo "\n-- negative limit (since PHP 5.1) --\n";
                     18: var_dump(explode('||', $str, -1));
                     19: 
                     20: echo "\n-- negative limit (since PHP 5.1) with null string -- \n";
                     21: var_dump(explode('||', "", -1));
                     22: ?>
                     23: ===DONE===
                     24: --EXPECT--
                     25: *** Testing explode() function: positive and negative limits ***
                     26: 
                     27: -- positive limit --
                     28: array(2) {
                     29:   [0]=>
                     30:   string(3) "one"
                     31:   [1]=>
                     32:   string(16) "two||three||four"
                     33: }
                     34: 
                     35: -- negative limit (since PHP 5.1) --
                     36: array(3) {
                     37:   [0]=>
                     38:   string(3) "one"
                     39:   [1]=>
                     40:   string(3) "two"
                     41:   [2]=>
                     42:   string(5) "three"
                     43: }
                     44: 
                     45: -- negative limit (since PHP 5.1) with null string -- 
                     46: array(0) {
                     47: }
                     48: ===DONE===

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