Annotation of embedaddon/php/ext/standard/tests/array/array_slice_variation10.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test array_slice() function : usage variations - position of internal array pointer
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
                      6:  * Description: Returns elements specified by offset and length 
                      7:  * Source code: ext/standard/array.c
                      8:  */
                      9: 
                     10: /*
                     11:  * Check position of internal array pointer after calling array_slice()
                     12:  */
                     13: 
                     14: echo "*** Testing array_slice() : usage variations ***\n";
                     15: 
                     16: $input = array ('one' => 'un', 'two' => 'deux', 23 => 'twenty-three', 'zero');
                     17: 
                     18: echo "\n-- Call array_slice() --\n";
                     19: var_dump($result = array_slice($input, 2));
                     20: 
                     21: echo "-- Position of Internal Pointer in Result: --\n";
                     22: echo key($result) . " => " . current($result) . "\n";
                     23: echo "\n-- Position of Internal Pointer in Original Array: --\n";
                     24: echo key($input) . " => " . current ($input) . "\n";
                     25: 
                     26: echo "Done";
                     27: ?>
                     28: 
                     29: --EXPECTF--
                     30: *** Testing array_slice() : usage variations ***
                     31: 
                     32: -- Call array_slice() --
                     33: array(2) {
                     34:   [0]=>
                     35:   string(12) "twenty-three"
                     36:   [1]=>
                     37:   string(4) "zero"
                     38: }
                     39: -- Position of Internal Pointer in Result: --
                     40: 0 => twenty-three
                     41: 
                     42: -- Position of Internal Pointer in Original Array: --
                     43: one => un
                     44: Done

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