3v4l.org

run code in 500+ PHP versions simultaneously
<?php class x { private $p = 5; function foo() { $b = 2; $f = fn($a) => $a + $b + $this->p; echo $f(1); // 8 = 1 + 2 + 5 $t = $this; $f = static fn($a) => $a + $b + $t->p; echo $f(1); // 8 = 1 + 2 + 5 $f = static fn($a) => $a + $b + $this->p; // Only an error if the code is executed //echo $f(1); } } new x()->foo();
Output for 8.6.0rc7
88
Output for master
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/git-master/modules/sodium.so (/usr/lib/php/git-master/modules/sodium.so: cannot open shared object file: No such file or directory), /usr/lib/php/git-master/modules/sodium.so.so (/usr/lib/php/git-master/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 88

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:
32.17 ms | 1189 KiB | 7 Q