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-- ReflectionClass::isIterateable() basic --CREDITS-- Felix De Vliegher <felix.devli..

Decoded Output download

--TEST--
ReflectionClass::isIterateable() basic
--CREDITS--
Felix De Vliegher <[email protected]>, Marc Veldman <[email protected]>
--FILE--
<?php

class IteratorClass implements Iterator {
    public function __construct() { }
    public function key(): mixed {}
    public function current(): mixed {}
    function next(): void {}
    function valid(): bool {}
    function rewind(): void {}
}
class DerivedClass extends IteratorClass {}
class NonIterator {}

function dump_iterateable($class) {
    $reflection = new ReflectionClass($class);
    var_dump($reflection->isIterateable());
}

$classes = array("ArrayObject", "IteratorClass", "DerivedClass", "NonIterator");
foreach ($classes as $class) {
    echo "Is $class iterateable? ";
    dump_iterateable($class);
}
?>
--EXPECT--
Is ArrayObject iterateable? bool(true)
Is IteratorClass iterateable? bool(true)
Is DerivedClass iterateable? bool(true)
Is NonIterator iterateable? bool(false)

Did this file decode correctly?

Original Code

--TEST--
ReflectionClass::isIterateable() basic
--CREDITS--
Felix De Vliegher <[email protected]>, Marc Veldman <[email protected]>
--FILE--
<?php

class IteratorClass implements Iterator {
    public function __construct() { }
    public function key(): mixed {}
    public function current(): mixed {}
    function next(): void {}
    function valid(): bool {}
    function rewind(): void {}
}
class DerivedClass extends IteratorClass {}
class NonIterator {}

function dump_iterateable($class) {
    $reflection = new ReflectionClass($class);
    var_dump($reflection->isIterateable());
}

$classes = array("ArrayObject", "IteratorClass", "DerivedClass", "NonIterator");
foreach ($classes as $class) {
    echo "Is $class iterateable? ";
    dump_iterateable($class);
}
?>
--EXPECT--
Is ArrayObject iterateable? bool(true)
Is IteratorClass iterateable? bool(true)
Is DerivedClass iterateable? bool(true)
Is NonIterator iterateable? bool(false)

Function Calls

None

Variables

None

Stats

MD5 5730b1337862e019845c1186e5dd53cb
Eval Count 0
Decode Time 82 ms