1--TEST--
2Test 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
23echo"\n*** Checking for internal array pointer being reset when pop is called ***\n";
24
25echo "\nCurrent Element is : ";
26var_dump( current($mixed_array[1]) );
27
28echo "\nNext Element is : ";
29var_dump( next($mixed_array[1]) );
30
31echo "\nNext Element is : ";
32var_dump( next($mixed_array[1]) );
33
34echo "\nPOPed Element is : ";
35var_dump( array_pop($mixed_array[1]) );
36
37echo "\nCurrent Element after POP operation is: ";
38var_dump( current($mixed_array[1]) );
39
40echo"\nDone";
41?>
42--EXPECTF--
43*** Checking for internal array pointer being reset when pop is called ***
44
45Current Element is : int(1)
46
47Next Element is : int(2)
48
49Next Element is : int(3)
50
51POPed Element is : int(9)
52
53Current Element after POP operation is: int(1)
54
55Done
56