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: RecursiveIteratorIterator and beginChildren/endChildren --FILE-- <?php clas..
Decoded Output download
--TEST--
SPL: RecursiveIteratorIterator and beginChildren/endChildren
--FILE--
<?php
class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator
{
function rewind(): void
{
echo "<ul>
";
parent::rewind();
}
function beginChildren(): void
{
echo str_repeat(' ',$this->getDepth())."<ul>
";
}
function endChildren(): void
{
echo str_repeat(' ',$this->getDepth())."</ul>
";
}
function valid(): bool
{
if (!parent::valid()) {
echo "<ul>
";
return false;
}
return true;
}
}
$arr = array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d");
$obj = new RecursiveArrayIterator($arr);
$rit = new RecursiveArrayIteratorIterator($obj);
foreach($rit as $k=>$v)
{
echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v
";
}
?>
--EXPECT--
<ul>
0=>a
<ul>
0=>ba
<ul>
0=>bba
1=>bbb
</ul>
<ul>
<ul>
0=>bcaa
</ul>
</ul>
</ul>
<ul>
0=>ca
</ul>
3=>d
<ul>
Did this file decode correctly?
Original Code
--TEST--
SPL: RecursiveIteratorIterator and beginChildren/endChildren
--FILE--
<?php
class RecursiveArrayIteratorIterator extends RecursiveIteratorIterator
{
function rewind(): void
{
echo "<ul>\n";
parent::rewind();
}
function beginChildren(): void
{
echo str_repeat(' ',$this->getDepth())."<ul>\n";
}
function endChildren(): void
{
echo str_repeat(' ',$this->getDepth())."</ul>\n";
}
function valid(): bool
{
if (!parent::valid()) {
echo "<ul>\n";
return false;
}
return true;
}
}
$arr = array("a", array("ba", array("bba", "bbb"), array(array("bcaa"))), array("ca"), "d");
$obj = new RecursiveArrayIterator($arr);
$rit = new RecursiveArrayIteratorIterator($obj);
foreach($rit as $k=>$v)
{
echo str_repeat(' ',$rit->getDepth()+1)."$k=>$v\n";
}
?>
--EXPECT--
<ul>
0=>a
<ul>
0=>ba
<ul>
0=>bba
1=>bbb
</ul>
<ul>
<ul>
0=>bcaa
</ul>
</ul>
</ul>
<ul>
0=>ca
</ul>
3=>d
<ul>
Function Calls
None |
Stats
MD5 | 550ee91a4e074e0e1595fdffdc297ac0 |
Eval Count | 0 |
Decode Time | 112 ms |