mirror of
https://github.com/php/php-src.git
synced 2024-12-22 00:10:16 +08:00
ded3d984c6
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
30 lines
491 B
PHP
30 lines
491 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));
|
|
?>
|
|
--EXPECT--
|
|
string(3) "baz"
|