File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array / reset_variation2.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:03 2012 UTC (12 years, 4 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Test reset() function : usage variations - unset first element
--FILE--
<?php
/* Prototype  : mixed reset(array $array_arg)
 * Description: Set array argument's internal pointer to the first element and return it 
 * Source code: ext/standard/array.c
 */

/*
 * Unset first element of an array and test behaviour of reset()
 */

echo "*** Testing reset() : usage variations ***\n";

$array = array('a', 'b', 'c');

echo "\n-- Initial Position: --\n";
echo current($array) . " => " . key($array) . "\n";

echo "\n-- Unset First element in array and check reset() --\n";
unset($array[0]);
var_dump(reset($array));
?>
===DONE===
--EXPECTF--
*** Testing reset() : usage variations ***

-- Initial Position: --
a => 0

-- Unset First element in array and check reset() --
string(1) "b"
===DONE===

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