mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
30 lines
492 B
PHP
30 lines
492 B
PHP
--TEST--
|
|
Bug #73753 Non packed arrays and duplication
|
|
--FILE--
|
|
<?php
|
|
function iterate($current, $a, $result = null) {
|
|
if (!$current) {
|
|
return $result;
|
|
}
|
|
|
|
return iterate(getNext($a), $a, $current);
|
|
}
|
|
|
|
function getNext(&$a) {
|
|
return next($a);
|
|
}
|
|
|
|
function getCurrent($a) {
|
|
return current($a);
|
|
}
|
|
|
|
function traverse($a) {
|
|
return iterate(getCurrent($a), $a);
|
|
}
|
|
|
|
$arr = array(1 => 'foo', 'b' => 'bar', 'baz');
|
|
var_dump(traverse($arr));
|
|
?>
|
|
--EXPECTF--
|
|
string(3) "baz"
|