1--TEST-- 2Test end() function : basic functionality 3--FILE-- 4<?php 5/* Prototype : mixed end(array $array_arg) 6 * Description: Advances array argument's internal pointer to the last element and return it 7 * Source code: ext/standard/array.c 8 */ 9 10/* 11 * Test basic functionality of end() 12 */ 13 14echo "*** Testing end() : basic functionality ***\n"; 15 16$array = array('zero', 'one', 200 => 'two'); 17 18echo "\n-- Initial Position: --\n"; 19echo key($array) . " => " . current($array) . "\n"; 20 21echo "\n-- Call to end() --\n"; 22var_dump(end($array)); 23 24echo "\n-- Current Position: --\n"; 25echo key($array) . " => " . current($array) . "\n"; 26 27echo "\n-- Add a new element to array --\n"; 28$array[2] = 'foo'; 29var_dump(end($array)); 30?> 31===DONE=== 32--EXPECTF-- 33*** Testing end() : basic functionality *** 34 35-- Initial Position: -- 360 => zero 37 38-- Call to end() -- 39string(3) "two" 40 41-- Current Position: -- 42200 => two 43 44-- Add a new element to array -- 45string(3) "foo" 46===DONE=== 47