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

1.1       misho       1: --TEST--
                      2: Test array_slice() function : basic functionality 
                      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:  * Test basic functionality of array_slice()
                     12:  */
                     13: 
                     14: echo "*** Testing array_slice() : basic functionality ***\n";
                     15: 
                     16: 
                     17: $input = array('one' => 1, 'two' => 2, 3, 23 => 4);
                     18: $offset = 2;
                     19: $length = 2;
                     20: $preserve_keys = true;
                     21: 
                     22: // Calling array_slice() with all possible arguments
                     23: echo "\n-- All arguments --\n";
                     24: var_dump( array_slice($input, $offset, $length, $preserve_keys) );
                     25: 
                     26: // Calling array_slice() with mandatory arguments
                     27: echo "\n-- Mandatory arguments --\n";
                     28: var_dump( array_slice($input, $offset) );
                     29: 
                     30: echo "Done";
                     31: ?>
                     32: 
                     33: --EXPECTF--
                     34: *** Testing array_slice() : basic functionality ***
                     35: 
                     36: -- All arguments --
                     37: array(2) {
                     38:   [0]=>
                     39:   int(3)
                     40:   [23]=>
                     41:   int(4)
                     42: }
                     43: 
                     44: -- Mandatory arguments --
                     45: array(2) {
                     46:   [0]=>
                     47:   int(3)
                     48:   [1]=>
                     49:   int(4)
                     50: }
                     51: Done

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