3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Job { private $details; public function __construct($details) { $this->details = $details; } public function requirements() { return $this->details; } } class StackDetector { public static function match($stack, $details) { return strpos($details, $stack) !== false; } } abstract class Handler { protected $successor; public function forwardToSuccessor($job) { if ($this->successor) { $this->successor->handle($job); } } abstract public function handle($job); } class PHPStack extends Handler { public function __construct($successor) { $this->successor = $successor; } public function handle($job) { if (StackDetector::match('PHP', $job->requirements())) { // Notify PHP developers echo 'PHP Stack'; } else { $this->forwardToSuccessor($job); } } } class JavaScriptStack extends Handler { public function __construct($successor) { $this->successor = $successor; } public function handle($job) { if (StackDetector::match('JavaScript', $job->requirements())) { // Notify JavaScript developers echo 'JavaScript Stack'; } else { $this->forwardToSuccessor($job); } } } class JavaStack extends Handler { public function __construct($successor) { $this->successor = $successor; } public function handle($job) { if (StackDetector::match('Java', $job->requirements())) { // Notify Java developers echo 'Java Stack'; } else { $this->forwardToSuccessor($job); } } } class DoNothing extends Handler { public function handle($job) { // Do nothing echo 'The request object is unhandled'; } } // Chain of Job handler objects $doNothing = new DoNothing(); $javaStack = new JavaStack($doNothing); $javaScriptStack = new JavaScriptStack($javaStack); $phpStack = new PHPStack($javaScriptStack); // The request object to be handled $job = new Job('PHP'); // Try changing the value to Python, JavaScript or Java // Starts handling the Job object $phpStack->handle($job);

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)
8.3.130.0040.00418.49
8.3.120.0100.00618.93
8.3.110.0080.00020.94
8.3.100.0080.00024.06
8.3.90.0140.00426.77
8.3.80.0030.00617.97
8.3.70.0160.00016.63
8.3.60.0070.00718.18
8.3.50.0110.00416.42
8.3.40.0000.01423.52
8.3.30.0080.00818.70
8.3.20.0000.00824.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.250.0110.00022.15
8.2.240.0140.00719.16
8.2.230.0040.00422.58
8.2.220.0030.00737.54
8.2.210.0000.01126.77
8.2.200.0040.00418.41
8.2.190.0110.01116.88
8.2.180.0070.00718.16
8.2.170.0100.00719.08
8.2.160.0110.00322.96
8.2.150.0070.00025.66
8.2.140.0030.00524.66
8.2.130.0030.01426.16
8.2.120.0000.00826.16
8.2.110.0060.00322.07
8.2.100.0030.00919.57
8.2.90.0040.00817.75
8.2.80.0060.00318.82
8.2.70.0060.00317.50
8.2.60.0050.00317.60
8.2.50.0030.00717.63
8.2.40.0000.00817.63
8.2.30.0120.00622.40
8.2.20.0030.00620.64
8.2.10.0060.00620.44
8.2.00.0100.00318.80
8.1.300.0090.00020.40
8.1.290.0000.01430.84
8.1.280.0120.00625.92
8.1.270.0050.00324.66
8.1.260.0060.00326.35
8.1.250.0080.00028.09
8.1.240.0060.00320.66
8.1.230.0060.00617.57
8.1.220.0080.00017.74
8.1.210.0000.00818.77
8.1.200.0080.00017.13
8.1.190.0040.00417.35
8.1.180.0120.00018.10
8.1.170.0040.00418.41
8.1.160.0050.00518.61
8.1.150.0090.00618.59
8.1.140.0110.00318.89
8.1.130.0160.00018.48
8.1.120.0150.00018.66
8.1.110.0160.00018.56
8.1.100.0070.00818.66
8.1.90.0130.00318.66
8.1.80.0130.00318.62
8.1.70.0110.00518.61
8.1.60.0140.00418.84
8.1.50.0170.00018.77
8.1.40.0150.00318.89
8.1.30.0150.00518.91
8.1.20.0120.00618.85
8.1.10.0150.00518.79
8.1.00.0130.00718.77
8.0.300.0030.00320.46
8.0.290.0030.00616.75
8.0.280.0080.00818.01
8.0.270.0140.00317.95
8.0.260.0110.00518.04
8.0.250.0120.00317.95
8.0.240.0040.01217.93
8.0.230.0110.00517.98
8.0.220.0120.00017.83
8.0.210.0000.01417.94
8.0.200.0060.00618.04
8.0.190.0110.00318.03
8.0.180.0000.01617.99
8.0.170.0050.00918.01
8.0.160.0060.00918.08
8.0.150.0120.00217.93
8.0.140.0090.00617.84
8.0.130.0130.00317.93
8.0.120.0100.00517.88
8.0.110.0110.00418.01
8.0.100.0100.00718.02
8.0.90.0120.00417.93
8.0.80.0070.00717.88
8.0.70.0100.00317.95
8.0.60.0060.00817.87
8.0.50.0130.00017.95
8.0.30.0050.00917.92
8.0.20.0120.00017.92
8.0.10.0090.00418.01

preferences:
18.31 ms | 403 KiB | 5 Q