3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private int $bar, $baz; } $foo_reflection = new ReflectionObject(new Foo); var_dump( array_map( function (ReflectionProperty $prop) { $visibility = null; switch ($prop->getModifiers()) { case ReflectionProperty::IS_PUBLIC: $visibility = 'public'; break; case ReflectionProperty::IS_PROTECTED: $visibility = 'protected'; break; case ReflectionProperty::IS_PRIVATE: $visibility = 'private'; break; } return [ 'Name' => $prop->getName(), 'Visibility' => $visibility, 'Type' => $prop->getTypeText(), ]; }, $foo_reflection->getProperties() ) );
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined method ReflectionProperty::getTypeText() in /in/7gefZ:29 Stack trace: #0 [internal function]: {closure}(Object(ReflectionProperty)) #1 /in/7gefZ(10): array_map(Object(Closure), Array) #2 {main} thrown in /in/7gefZ on line 29
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
112.95 ms | 2172 KiB | 4 Q