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

1.1       misho       1: --TEST--
                      2: Test array_reverse() function : basic functionality - associative array for 'array' argument
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : array array_reverse(array $array [, bool $preserve_keys])
                      6:  * Description: Return input as a new array with the order of the entries reversed 
                      7:  * Source code: ext/standard/array.c
                      8: */
                      9: 
                     10: /*
                     11:  * Testing array_reverse() with associative array for $array argument
                     12: */
                     13: 
                     14: echo "*** Testing array_reverse() : basic functionality ***\n";
                     15: 
                     16: // Initialise the array
                     17: $array = array("a" => "hello", 123 => "number", 'string' => 'blue', "10" => 13.33);
                     18: 
                     19: // Calling array_reverse() with default arguments
                     20: var_dump( array_reverse($array) );
                     21: 
                     22: // Calling array_reverse() with all possible arguments
                     23: var_dump( array_reverse($array, true) );  // expects the keys to be preserved
                     24: var_dump( array_reverse($array, false) );  // expects the keys not to be preserved
                     25: 
                     26: echo "Done";
                     27: ?>
                     28: --EXPECTF--
                     29: *** Testing array_reverse() : basic functionality ***
                     30: array(4) {
                     31:   [0]=>
                     32:   float(13.33)
                     33:   ["string"]=>
                     34:   string(4) "blue"
                     35:   [1]=>
                     36:   string(6) "number"
                     37:   ["a"]=>
                     38:   string(5) "hello"
                     39: }
                     40: array(4) {
                     41:   [10]=>
                     42:   float(13.33)
                     43:   ["string"]=>
                     44:   string(4) "blue"
                     45:   [123]=>
                     46:   string(6) "number"
                     47:   ["a"]=>
                     48:   string(5) "hello"
                     49: }
                     50: array(4) {
                     51:   [0]=>
                     52:   float(13.33)
                     53:   ["string"]=>
                     54:   string(4) "blue"
                     55:   [1]=>
                     56:   string(6) "number"
                     57:   ["a"]=>
                     58:   string(5) "hello"
                     59: }
                     60: Done

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