1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
--TEST--
Test current() function : usage variations - reference & normal parameters
--FILE--
<?php
/* Prototype : mixed current(array $array_arg)
* Description: Return the element currently pointed to by the internal array pointer
* Source code: ext/standard/array.c
* Alias to functions: pos
*/
echo "*** Testing current() : usage variations ***\n";
echo "\n-- Function: reference parameter --\n";
function current_variation5_ref(&$a)
{
var_dump(current($a));
var_dump(next($a));
}
$a = array('yes', 'maybe', 'no');
var_dump(current($a));
var_dump(next($a));
current_variation5($a);
echo "\n-- Function: normal parameter --\n";
function current_variation5($a)
{
var_dump(current($a));
var_dump(next($a));
}
$a = array('yes', 'maybe', 'no');
var_dump(current($a));
var_dump(next($a));
current_variation5($a);
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
*** Testing current() : usage variations ***
-- Function: reference parameter --
string(3) "yes"
string(5) "maybe"
string(5) "maybe"
string(2) "no"
-- Function: normal parameter --
string(3) "yes"
string(5) "maybe"
string(5) "maybe"
string(2) "no"
===DONE===
|