3v4l.org

run code in 300+ PHP versions simultaneously
<?php //var_dump(get_defined_constants(true)['Core']); class Foo { const ERR_SOME_CONST = 6001; const ERR_SOME_OTHER_CONST = 5001; function bar() { $x = 6001; $fooClass = new ReflectionClass ( 'Foo' ); $constants = $fooClass->getConstants(); $constants = get_defined_constants(); $constName = null; foreach ( $constants as $name => $value ) { if ( $value == $x ) { $constName = $name; break; } } echo $constName; } } echo (new Foo)->bar();
Output for git.master, git.master_jit, rfc.property-hooks
TRUE

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:
30.56 ms | 401 KiB | 8 Q