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::getSubIterator() returns different iterators depe..

Decoded Output download

--TEST--
SPL: RecursiveIteratorIterator::getSubIterator() returns different iterators depending on the current element
--CREDITS--
Matt Raines [email protected]
#testfest London 2009-05-09
--FILE--
<?php
$sample_array = array(1, 2, array(3, 4));

$iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($sample_array));

$iterator->next();
$iterator->next();
var_dump(get_class($iterator->getSubIterator()));
var_dump($iterator->getSubIterator()->getArrayCopy());
$iterator->next();
var_dump(get_class($iterator->getSubIterator()));
var_dump($iterator->getSubIterator()->getArrayCopy());
?>
--EXPECT--
string(22) "RecursiveArrayIterator"
array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  array(2) {
    [0]=>
    int(3)
    [1]=>
    int(4)
  }
}
string(22) "RecursiveArrayIterator"
array(2) {
  [0]=>
  int(3)
  [1]=>
  int(4)
}

Did this file decode correctly?

Original Code

--TEST--
SPL: RecursiveIteratorIterator::getSubIterator() returns different iterators depending on the current element
--CREDITS--
Matt Raines [email protected]
#testfest London 2009-05-09
--FILE--
<?php
$sample_array = array(1, 2, array(3, 4));

$iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($sample_array));

$iterator->next();
$iterator->next();
var_dump(get_class($iterator->getSubIterator()));
var_dump($iterator->getSubIterator()->getArrayCopy());
$iterator->next();
var_dump(get_class($iterator->getSubIterator()));
var_dump($iterator->getSubIterator()->getArrayCopy());
?>
--EXPECT--
string(22) "RecursiveArrayIterator"
array(3) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  [2]=>
  array(2) {
    [0]=>
    int(3)
    [1]=>
    int(4)
  }
}
string(22) "RecursiveArrayIterator"
array(2) {
  [0]=>
  int(3)
  [1]=>
  int(4)
}

Function Calls

None

Variables

$sample_array [{'key': 0, 'value': 1}, {'key': 1, 'value': 2}, {'key': 2, 'value': [{'key': 0, 'value': 3}, {'key': 1, 'value': 4}]}]

Stats

MD5 7604902be57c7c7467a12f1159a19091
Eval Count 0
Decode Time 88 ms