mirror of
https://github.com/php/php-src.git
synced 2024-09-29 05:46:06 +00:00
7dc322754a
- Fix issues with info-class/file-class in SPL directory handling classes - Add SimpleXMLElement::count() - Drop erroneous RecursiveDirectoryIterator::getSubPathInfo() - Drop dead code - Add tests - Update docu
33 lines
710 B
PHP
Executable File
33 lines
710 B
PHP
Executable File
--TEST--
|
|
SPL: ArrayIterator and foreach by reference
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("spl")) print "skip"; ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$ar = new ArrayObject(array(1)); foreach($ar as &$v) var_dump($v);
|
|
$ar = new ArrayIterator(array(2)); foreach($ar as &$v) var_dump($v);
|
|
$ar = new RecursiveArrayIterator(array(3)); foreach($ar as &$v) var_dump($v);
|
|
|
|
class ArrayIteratorEx extends ArrayIterator
|
|
{
|
|
function current()
|
|
{
|
|
return ArrayIterator::current();
|
|
}
|
|
}
|
|
|
|
$ar = new ArrayIteratorEx(array(4)); foreach($ar as $v) var_dump($v);
|
|
$ar = new ArrayIteratorEx(array(5)); foreach($ar as &$v) var_dump($v);
|
|
|
|
?>
|
|
===DONE===
|
|
<?php exit(0); ?>
|
|
--EXPECTF--
|
|
int(1)
|
|
int(2)
|
|
int(3)
|
|
int(4)
|
|
int(5)
|
|
===DONE===
|