3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $callable; public function __construct() { $this->callable = function () { echo "hello world!"; }; } public function yesItDoes() { ($this->callable)(); } } class Bar { private $name; public function __construct($id) { $this->name = function ($id) { echo "Hello ".$id } } public function getName() { ($this->name)(); } } (new Bar('eric'))-getName(); (new Foo)->yesItDoes();

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.0.10.0100.08320.12
7.0.00.0070.04020.23
5.6.160.0070.05320.44
5.6.150.0130.06018.25
5.6.140.0070.03718.23
5.6.130.0030.08718.28
5.6.120.0000.04721.00
5.6.110.0070.08021.00
5.6.100.0130.05320.99
5.6.90.0100.08721.00
5.6.80.0030.08720.42
5.5.300.0000.04318.04
5.5.290.0070.08317.98
5.5.280.0070.04720.89
5.5.270.0030.07320.90
5.5.260.0070.08320.77
5.5.250.0100.07720.59
5.5.240.0200.07320.29

preferences:
143 ms | 1386 KiB | 7 Q