Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- SPL: IteratorIterator and ArrayIterator/Object --FILE-- <?php class ArrayIterato..
Decoded Output download
--TEST--
SPL: IteratorIterator and ArrayIterator/Object
--FILE--
<?php
class ArrayIteratorEx extends ArrayIterator
{
function rewind(): void
{
echo __METHOD__ . "
";
parent::rewind();
}
}
$it = new ArrayIteratorEx(range(0,3));
foreach(new IteratorIterator($it) as $v)
{
var_dump($v);
}
class ArrayObjectEx extends ArrayObject
{
function getIterator(): Iterator
{
echo __METHOD__ . "
";
return parent::getIterator();
}
}
$it = new ArrayObjectEx(range(0,3));
foreach(new IteratorIterator($it) as $v)
{
var_dump($v);
}
?>
--EXPECT--
ArrayIteratorEx::rewind
int(0)
int(1)
int(2)
int(3)
ArrayObjectEx::getIterator
int(0)
int(1)
int(2)
int(3)
Did this file decode correctly?
Original Code
--TEST--
SPL: IteratorIterator and ArrayIterator/Object
--FILE--
<?php
class ArrayIteratorEx extends ArrayIterator
{
function rewind(): void
{
echo __METHOD__ . "\n";
parent::rewind();
}
}
$it = new ArrayIteratorEx(range(0,3));
foreach(new IteratorIterator($it) as $v)
{
var_dump($v);
}
class ArrayObjectEx extends ArrayObject
{
function getIterator(): Iterator
{
echo __METHOD__ . "\n";
return parent::getIterator();
}
}
$it = new ArrayObjectEx(range(0,3));
foreach(new IteratorIterator($it) as $v)
{
var_dump($v);
}
?>
--EXPECT--
ArrayIteratorEx::rewind
int(0)
int(1)
int(2)
int(3)
ArrayObjectEx::getIterator
int(0)
int(1)
int(2)
int(3)
Function Calls
None |
Stats
MD5 | f8e2e0a1351cb282440170bcb264f7e6 |
Eval Count | 0 |
Decode Time | 97 ms |