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

1.1       misho       1: --TEST--
                      2: Test array_pop() function (variation)
                      3: --FILE--
                      4: <?php
                      5: 
                      6: /* Various combinations of arrays to be used for the test */
                      7: $mixed_array = array(
                      8:   array(),
                      9:   array( 1,2,3,4,5,6,7,8,9 ),
                     10:   array( "One", "_Two", "Three", "Four", "Five" ),
                     11:   array( 6, "six", 7, "seven", 8, "eight", 9, "nine" ),
                     12:   array( "a" => "aaa", "A" => "AAA", "c" => "ccc", "d" => "ddd", "e" => "eee" ),
                     13:   array( "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five" ),
                     14:   array( 1 => "one", 2 => "two", 3 => 7, 4 => "four", 5 => "five" ),
                     15:   array( "f" => "fff", "1" => "one", 4 => 6, "" => "blank", 2.4 => "float", "F" => "FFF",
                     16:          "blank" => "", 3.7 => 3.7, 5.4 => 7, 6 => 8.6, '5' => "Five", "4name" => "jonny", "a" => NULL, NULL => 3 ),
                     17:   array( 12, "name", 'age', '45' ),
                     18:   array( array("oNe", "tWo", 4), array(10, 20, 30, 40, 50), array() ),
                     19:   array( "one" => 1, "one" => 2, "three" => 3, 3, 4, 3 => 33, 4 => 44, 5, 6,
                     20:           5.4 => 54, 5.7 => 57, "5.4" => 554, "5.7" => 557 )
                     21: );
                     22: 
                     23: echo"\n*** Checking for internal array pointer being reset when pop is called ***\n";
                     24: 
                     25: echo "\nCurrent Element is : ";
                     26: var_dump( current($mixed_array[1]) );
                     27: 
                     28: echo "\nNext Element is : ";
                     29: var_dump( next($mixed_array[1]) );
                     30: 
                     31: echo "\nNext Element is : ";
                     32: var_dump( next($mixed_array[1]) );
                     33: 
                     34: echo "\nPOPed Element is : ";
                     35: var_dump( array_pop($mixed_array[1]) );
                     36: 
                     37: echo "\nCurrent Element after POP operation is: ";
                     38: var_dump( current($mixed_array[1]) );
                     39: 
                     40: echo"\nDone";
                     41: ?>
                     42: --EXPECTF--
                     43: *** Checking for internal array pointer being reset when pop is called ***
                     44: 
                     45: Current Element is : int(1)
                     46: 
                     47: Next Element is : int(2)
                     48: 
                     49: Next Element is : int(3)
                     50: 
                     51: POPed Element is : int(9)
                     52: 
                     53: Current Element after POP operation is: int(1)
                     54: 
                     55: Done

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