3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public ?string $foo; public string $foobar; public ?string $bar = ''; } $vars = get_object_vars(new A); var_dump(assert(array_key_exists('bar', $vars)) ? 'bar exists in $vars' : 'bar does not exist in $vars'); var_dump(assert(array_key_exists('foobar', $vars)) ? 'foobar exists in $vars' : 'foobar does not exist in $vars'); var_dump(assert(array_key_exists('foo', $vars)) ? 'foo exists in $vars' : 'foo does not exist in $vars');
Output for git.master, git.master_jit, rfc.property-hooks
string(19) "bar exists in $vars" Fatal error: Uncaught AssertionError: assert(array_key_exists('foobar', $vars)) in /in/eg6o0:12 Stack trace: #0 /in/eg6o0(12): assert(false, 'assert(array_ke...') #1 {main} thrown in /in/eg6o0 on line 12
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:
17.84 ms | 401 KiB | 8 Q