3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { protected $protectedVariable; public function __construct() { $this->protectedVariable = 'this belongs to test class'; } } $x = new class ($passedVar) extends Test { public $holder; public $publicVar; public function __construct($classArg) { parent::__construct(); $this->holder = $classArg; } public function multiplyByNo($multiplier) { return $this->holder * $multiplier; } }; $templateFunction = function ($someNumber) { return $this->multiplyByNo($someNumber); } var_dump($x->call($templateFunction, 10));

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.0130.08020.06
7.0.00.0170.06720.07
5.6.160.0130.06720.57
5.6.150.0070.06318.16
5.6.140.0030.08318.17
5.6.130.0030.04018.15
5.6.120.0130.04721.08
5.6.110.0070.04720.98
5.6.100.0130.07020.99
5.6.90.0000.08721.10
5.6.80.0030.04320.49
5.5.300.0030.05017.98
5.5.290.0070.08017.98
5.5.280.0000.07720.84
5.5.270.0000.06020.84
5.5.260.0130.07720.68
5.5.250.0100.03320.78
5.5.240.0200.07720.04

preferences:
148.28 ms | 1394 KiB | 7 Q