3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ServiceLocator { public function getBuzzer() { return new Buzzer; } } class Buzzer { public function __construct() { sleep(5); } public function buzz() { echo "Buzz!"; } } class BuzzerProxy extends Buzzer { protected $sl; protected $initialized; protected $instance; public function __construct(ServiceLocator $sl) { $this->sl = $sl; } private function initialize() { $this->instance = $this->sl->getBuzzer(); $this->initialized = true; } public function buzz() { if (!$this->initialized) {$this->initialize();} return $this->instance->buzz(); } } $now = microtime(); $sl = new ServiceLocator; echo "Created service locator in " . microtime() - $now . "ms\n"; $now = microtime(); $proxy = new BuzzerProxy($sl); echo "Created buzzer proxy in " . microtime() - $now . "ms\n"; $now = microtime(); $proxy->buzz(); echo "Buzzed after " . microtime() - $now . "ms\n";

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.2.00.0000.01019.59
7.1.70.0020.00517.09
7.1.60.0080.00419.82
7.1.50.0000.01417.09
7.1.00.0000.03722.36
7.0.200.0050.00216.83
7.0.140.0070.06322.07
7.0.100.0470.06320.04
7.0.90.0100.08020.05
7.0.80.0000.05019.96
7.0.70.0030.08320.15
7.0.60.0070.04719.89
7.0.50.0470.06020.41
7.0.40.0170.07320.05
7.0.30.0070.05720.07
7.0.20.0030.08020.04
7.0.10.0070.08019.99
7.0.00.0070.09319.99
5.6.280.0030.07321.12
5.6.250.0170.06020.57
5.6.240.0100.06720.59
5.6.230.0000.06020.58
5.6.220.0070.08020.63
5.6.210.0130.04720.50
5.6.200.0170.07721.09
5.6.190.0130.07721.11
5.6.180.0070.09021.13
5.6.170.0070.08721.03
5.6.160.0200.07021.02
5.6.150.0030.04320.97
5.6.140.0030.04721.02
5.6.130.0030.04020.97
5.6.120.0100.07321.03
5.6.110.0130.07720.98
5.6.100.0200.07021.16
5.6.90.0100.08021.01
5.6.80.0200.07320.56
5.6.70.0070.07720.41
5.6.60.0030.04720.34
5.6.50.0030.08320.43
5.6.40.0100.07720.32
5.6.30.0100.08020.51
5.6.20.0170.07320.43
5.6.10.0100.06720.30
5.6.00.0100.08020.50
5.5.380.0170.07320.41
5.5.370.0200.06720.37
5.5.360.0170.06320.57
5.5.350.0030.04320.44
5.5.340.0170.05720.88
5.5.330.0100.08020.89
5.5.320.0130.08020.77
5.5.310.0100.07020.77
5.5.300.0130.03320.88
5.5.290.0130.05720.99
5.5.280.0100.06720.96
5.5.270.0230.08020.95
5.5.260.0100.06020.98
5.5.250.0100.08320.55
5.5.240.0270.06720.28
5.5.230.0000.04320.15
5.5.220.0030.06720.18
5.5.210.0070.08020.32
5.5.200.0100.06020.29
5.5.190.0200.05720.26
5.5.180.0270.04720.20
5.5.160.0200.06320.10
5.5.150.0030.07020.23
5.5.140.0030.04020.24
5.5.130.0230.06320.30
5.5.120.0100.05320.14
5.5.110.0130.07020.33
5.5.100.0030.06020.18
5.5.90.0070.08320.10
5.5.80.0200.06320.03
5.5.70.0170.05720.14
5.5.60.0130.05720.13
5.5.50.0170.04720.17
5.5.40.0030.07020.13
5.5.30.0100.05720.01
5.5.20.0130.05720.13
5.5.10.0130.08020.07
5.5.00.0100.07719.96
5.4.450.0100.07719.55
5.4.440.0100.07719.32
5.4.430.0030.08719.39
5.4.420.0070.08019.35
5.4.410.0100.06019.09
5.4.400.0200.04719.20
5.4.390.0000.06318.82
5.4.380.0130.05719.09
5.4.370.0100.07318.80
5.4.360.0100.05718.96
5.4.350.0030.07319.05
5.4.340.0330.05318.89
5.4.320.0070.06018.97
5.4.310.0130.07019.11
5.4.300.0130.06318.88
5.4.290.0000.04719.15
5.4.280.0000.09019.08
5.4.270.0100.07719.12
5.4.260.0170.06319.07
5.4.250.0370.04719.07
5.4.240.0170.06718.93
5.4.230.0230.05719.22
5.4.220.0130.04718.79
5.4.210.0130.09319.05
5.4.200.0000.08318.99
5.4.190.0100.03718.93
5.4.180.0100.07319.11
5.4.170.0030.08019.05
5.4.160.0100.07318.97
5.4.150.0030.08018.77
5.4.140.0100.06716.25
5.4.130.0200.04716.46
5.4.120.0000.08016.48
5.4.110.0070.05316.49
5.4.100.0100.07716.46
5.4.90.0070.06716.45
5.4.80.0030.04016.40
5.4.70.0100.06016.42
5.4.60.0070.06016.36
5.4.50.0070.05716.35
5.4.40.0130.06016.35
5.4.30.0030.07716.35
5.4.20.0200.04316.50
5.4.10.0100.05016.46
5.4.00.0130.05315.82
5.3.290.0130.05714.47
5.3.280.0170.07014.50
5.3.270.0100.07314.37
5.3.260.0130.07014.48
5.3.250.0200.04314.50
5.3.240.0070.08314.51
5.3.230.0070.07714.43
5.3.220.0030.05714.39
5.3.210.0130.06314.43
5.3.200.0170.05314.29
5.3.190.0000.04314.38
5.3.180.0200.06314.39
5.3.170.0030.08714.52
5.3.160.0070.05314.43
5.3.150.0130.07014.34
5.3.140.0100.07014.39
5.3.130.0100.06014.42
5.3.120.0070.08314.32
5.3.110.0170.06314.35
5.3.100.0170.05013.82
5.3.90.0130.06713.87
5.3.80.0070.07013.73
5.3.70.0230.04313.86
5.3.60.0070.05713.81
5.3.50.0100.05713.80
5.3.40.0070.06013.82
5.3.30.0070.07313.80
5.3.20.0000.05713.59
5.3.10.0130.04313.51
5.3.00.0100.05713.63
5.2.170.0030.06011.00
5.2.160.0030.06310.85
5.2.150.0030.06311.26
5.2.140.0100.04710.99
5.2.130.0000.05711.26
5.2.120.0130.03710.94
5.2.110.0100.06011.26
5.2.100.0170.04310.86
5.2.90.0100.03710.86
5.2.80.0100.03710.86
5.2.70.0030.05711.26
5.2.60.0030.04711.26
5.2.50.0030.05010.85
5.2.40.0100.05310.79
5.2.30.0130.04310.94
5.2.20.0100.04010.79
5.2.10.0070.05711.26
5.2.00.0000.06711.26
5.1.60.0030.0339.92
5.1.50.0070.0439.88
5.1.40.0070.0409.86
5.1.30.0070.05711.26
5.1.20.0030.03710.21
5.1.10.0100.05011.26
5.1.00.0070.05311.26
5.0.50.0000.04311.26
5.0.40.0030.04011.30
5.0.30.0100.0478.13
5.0.20.0030.04711.32
5.0.10.0030.04011.33
5.0.00.0130.04311.33
4.4.90.0030.03311.26
4.4.80.0070.02711.26
4.4.70.0030.03311.26
4.4.60.0030.02311.26
4.4.50.0000.03711.26
4.4.40.0000.03011.26
4.4.30.0000.01711.26
4.4.20.0000.04011.26
4.4.10.0000.03711.26
4.4.00.0030.05711.27
4.3.110.0000.04011.30
4.3.100.0000.03711.32
4.3.90.0000.01711.32
4.3.80.0030.04711.33
4.3.70.0070.02711.33
4.3.60.0030.02011.33
4.3.50.0000.03711.33
4.3.40.0000.05011.33
4.3.30.0030.03311.33
4.3.20.0000.03311.33
4.3.10.0030.03311.33
4.3.00.0000.03311.33

preferences:
41.26 ms | 401 KiB | 5 Q