<?php
class Foo extends \ArrayIterator
{
}
$fooReflection = new \ReflectionClass(\Foo::class);
$recursiveArrayIteratorReflection = new \ReflectionClass(\RecursiveArrayIterator::class);
printf("%d constants in %s, ", count($fooReflection->getConstants()), \Foo::class);
if ($fooReflection->getParentClass()) {
printf("%s extends %s\n", Foo::class, $fooReflection->getParentClass()->getName());
}
printf("%d constants in %s, ", count($recursiveArrayIteratorReflection->getConstants()), \RecursiveArrayIterator::class);
if ($recursiveArrayIteratorReflection->getParentClass()) {
printf("%s extends %s\n", \RecursiveArrayIterator::class, $recursiveArrayIteratorReflection->getParentClass()->getName());
}
printf("%d constants in %s\n", count((new \ReflectionClass(\ArrayIterator::class))->getConstants()), \ArrayIterator::class);
preferences:
51.09 ms | 402 KiB | 5 Q