3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $b = null; protected static $instance = null; public static function get() { if (static::$instance === null) { static::$instance = new static(); } return static::$instance; } public function __construct() { echo __METHOD__ . PHP_EOL; $this->b = Bar::get(); } public function __destruct() { echo __METHOD__ . PHP_EOL; $this->b->func(); } } class Bar { public $destroyed = false; protected static $instance = null; public static function get() { if (static::$instance === null) { static::$instance = new static(); } return static::$instance; } public function __construct() { echo __METHOD__ . PHP_EOL; } public function __destruct() { echo __METHOD__ . PHP_EOL; $this->destroyed = true; } public function func() { echo __METHOD__ . PHP_EOL; } } Bar::get(); Foo::get();

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.60.0060.00916.50
8.3.50.0100.00822.12
8.3.40.0000.01818.57
8.3.30.0110.00818.73
8.3.20.0040.00420.39
8.3.10.0110.00018.64
8.3.00.0030.00620.69
8.2.180.0150.00618.56
8.2.170.0070.01122.96
8.2.160.0090.00620.52
8.2.150.0090.00024.18
8.2.140.0080.00024.66
8.2.130.0070.00317.63
8.2.120.0060.00326.35
8.2.110.0070.00321.06
8.2.100.0090.00317.63
8.2.90.0050.00319.04
8.2.80.0080.00017.97
8.2.70.0030.00517.60
8.2.60.0000.00917.80
8.2.50.0030.00518.10
8.2.40.0050.00520.59
8.2.30.0040.00421.18
8.2.20.0050.00517.71
8.2.10.0040.00418.02
8.2.00.0050.00318.04
8.1.280.0090.00925.92
8.1.270.0000.00824.02
8.1.260.0050.00228.09
8.1.250.0030.00528.09
8.1.240.0090.00022.71
8.1.230.0110.00017.54
8.1.220.0000.01017.74
8.1.210.0030.00518.77
8.1.200.0000.00917.10
8.1.190.0000.00917.22
8.1.180.0090.00018.10
8.1.170.0060.00318.43
8.1.160.0040.00420.81
8.1.150.0070.00018.71
8.1.140.0000.00719.58
8.1.130.0040.00417.54
8.1.120.0030.00317.41
8.1.110.0100.00017.37
8.1.100.0000.00717.32
8.1.90.0040.00417.29
8.1.80.0000.00717.30
8.1.70.0030.00317.35
8.1.60.0040.00417.49
8.1.50.0000.00817.57
8.1.40.0040.00417.54
8.1.30.0050.00317.63
8.1.20.0050.00317.54
8.1.10.0040.00417.55
8.1.00.0040.00417.41
8.0.300.0040.00418.77
8.0.290.0000.00716.75
8.0.280.0000.00718.38
8.0.270.0040.00417.21
8.0.260.0000.00817.15
8.0.250.0030.00316.85
8.0.240.0080.00016.77
8.0.230.0030.00316.95
8.0.220.0000.00816.71
8.0.210.0030.00316.77
8.0.200.0000.00616.88
8.0.190.0000.00716.87
8.0.180.0040.00416.80
8.0.170.0000.00716.86
8.0.160.0040.00416.91
8.0.150.0000.00716.82
8.0.140.0040.00416.73
8.0.130.0000.00713.32
8.0.120.0000.00816.79
8.0.110.0000.00816.76
8.0.100.0000.00816.72
8.0.90.0000.00816.89
8.0.80.0100.01316.80
8.0.70.0040.00416.82
8.0.60.0040.00416.92
8.0.50.0050.00316.96
8.0.30.0100.00817.13
8.0.20.0080.01117.40
8.0.10.0030.00316.80
8.0.00.0100.01016.75
7.4.330.0050.00015.08
7.4.320.0040.00416.41
7.4.300.0040.00416.50
7.4.290.0050.00216.47
7.4.280.0030.00516.65
7.4.270.0000.00616.57
7.4.260.0030.00316.52
7.4.250.0070.00016.58
7.4.240.0050.00216.60
7.4.230.0030.00516.41
7.4.220.0140.00316.44
7.4.210.0100.00816.56
7.4.200.0040.00416.63
7.4.160.0040.01116.40
7.4.150.0040.01517.40
7.4.140.0110.00617.86
7.4.130.0130.00516.55
7.4.120.0080.00916.48
7.4.110.0000.01716.72
7.4.100.0070.01116.60
7.4.90.0080.00816.48
7.4.80.0070.01119.39
7.4.70.0150.00416.35
7.4.60.0090.00916.46
7.4.50.0040.01216.61
7.4.40.0060.01016.34
7.4.30.0090.00816.59
7.4.10.0100.00715.62
7.4.00.0080.00815.49
7.3.330.0060.00013.34
7.3.320.0060.00013.05
7.3.310.0040.00416.11
7.3.300.0030.00316.28
7.3.290.0000.00716.32
7.3.280.0080.01016.29
7.3.270.0130.00317.40
7.3.260.0090.00916.38
7.3.250.0100.00716.45
7.3.240.0120.00816.54
7.3.230.0090.00916.41
7.3.210.0130.00316.21
7.3.200.0140.00719.39
7.3.190.0080.00816.45
7.3.180.0100.00616.37
7.3.170.0060.01016.32
7.3.160.0080.00916.31
7.3.130.0070.00715.45
7.3.120.0060.01315.70
7.3.110.0070.00815.67
7.3.100.0060.00715.65
7.3.90.0070.00715.39
7.3.80.0060.00815.73
7.3.70.0060.00815.51
7.3.60.0040.00615.62
7.3.50.0020.01115.51
7.3.40.0050.00815.51
7.3.30.0030.01115.55
7.3.20.0020.01417.28
7.3.10.0230.00516.89
7.3.00.0230.00617.04
7.2.330.0090.00916.68
7.2.320.0060.01216.75
7.2.310.0090.01416.55
7.2.300.0110.00716.67
7.2.290.0120.00616.61
7.2.260.0100.01016.03
7.2.250.0090.01115.72
7.2.240.0080.00815.69
7.2.230.0080.00515.67
7.2.220.0030.01315.79
7.2.210.0100.00515.61
7.2.200.0030.00815.70
7.2.190.0070.00815.70
7.2.180.0060.00815.80
7.2.170.0040.01115.84
7.2.160.0060.01115.79
7.2.150.0030.00917.53
7.2.140.0100.00217.44
7.2.130.0180.00817.32
7.2.120.0140.01117.27
7.2.110.0190.00817.31
7.2.100.0110.00717.24
7.2.90.0170.01117.36
7.2.80.0150.00617.28
7.2.70.0210.01017.16
7.2.60.0210.00917.22
7.2.50.0200.00817.29
7.2.40.0310.00817.28
7.2.30.0140.00917.41
7.2.20.0150.00817.33
7.2.10.0100.01017.20
7.2.00.0120.00717.36
7.1.330.0070.00916.40
7.1.320.0060.00616.35
7.1.310.0030.01016.54
7.1.300.0070.00616.49
7.1.290.0020.01116.46
7.1.280.0030.00716.36
7.1.270.0050.00716.60
7.1.260.0080.00616.37
7.1.250.0150.00716.03
7.1.240.0100.00716.37
7.1.230.0060.00816.43
7.1.220.0030.01016.40
7.1.210.0050.01016.39
7.1.200.0090.00316.15
7.1.190.0080.00616.50
7.1.180.0070.00716.56
7.1.170.0090.00516.49
7.1.160.0030.00716.52
7.1.150.0080.00716.44
7.1.140.0040.00916.52
7.1.130.0060.00816.57
7.1.120.0040.00816.25
7.1.110.0070.00916.44
7.1.100.0030.00717.11
7.1.90.0070.00516.48
7.1.80.0070.00716.38
7.1.70.0040.00816.70
7.1.60.0050.00917.35
7.1.50.0100.00416.33
7.1.40.0060.00716.51
7.1.30.0020.00916.47
7.1.20.0050.00916.48
7.1.10.0050.00816.59
7.1.00.0030.03118.48
7.0.330.0040.01116.15
7.0.320.0040.00616.12
7.0.310.0070.00515.83
7.0.300.0080.00716.28
7.0.290.0060.00616.13
7.0.280.0020.01116.13
7.0.270.0060.01016.10
7.0.260.0070.00516.13
7.0.250.0040.00816.29
7.0.240.0070.00816.28
7.0.230.0040.00916.28
7.0.220.0030.01216.36
7.0.210.0070.00516.15
7.0.200.0060.00816.38
7.0.190.0020.01216.19
7.0.180.0040.00916.00
7.0.170.0020.00816.32
7.0.160.0050.00716.15
7.0.150.0070.00816.09
7.0.140.0020.01316.00
7.0.130.0040.01116.10
7.0.120.0030.00916.05
7.0.110.0060.00516.06
7.0.100.0050.03117.43
7.0.90.0150.02117.49
7.0.80.0080.02417.34
7.0.70.0070.01517.46
7.0.60.0090.02817.52
7.0.50.0050.02117.59
7.0.40.0070.02316.21
7.0.30.0120.01215.99
7.0.20.0050.02816.23
7.0.10.0090.03116.04
7.0.00.0040.03316.11
5.6.400.0060.00915.07
5.6.390.0050.00915.11
5.6.380.0070.00514.93
5.6.370.0090.00515.26
5.6.360.0080.00715.17
5.6.350.0080.00515.38
5.6.340.0020.01115.11
5.6.330.0040.01215.05
5.6.320.0060.00615.07
5.6.310.0020.01215.29
5.6.300.0030.01215.22
5.6.290.0030.01015.03
5.6.280.0070.02817.00
5.6.270.0030.00915.12
5.6.260.0070.00515.06
5.6.250.0100.02416.88
5.6.240.0060.02116.99
5.6.230.0090.02416.97
5.6.220.0090.01417.04
5.6.210.0100.03017.07
5.6.200.0040.03117.01
5.6.190.0100.03017.14
5.6.180.0040.03417.11
5.6.170.0040.02417.05
5.6.160.0090.02817.08
5.6.150.0060.02917.15
5.6.140.0100.02117.08
5.6.130.0030.02517.00
5.6.120.0080.02817.25
5.6.110.0080.01717.04
5.6.100.0090.03017.05
5.6.90.0080.03317.03
5.6.80.0110.02816.79
5.6.70.0090.02716.89
5.6.60.0060.02816.89
5.6.50.0090.02816.80
5.6.40.0010.02316.76
5.6.30.0070.02316.81
5.6.20.0050.02116.84
5.6.10.0040.03216.82
5.6.00.0070.03116.84
5.5.380.0050.03216.82
5.5.370.0040.02816.86
5.5.360.0080.02916.83
5.5.350.0090.03116.96
5.5.340.0070.02917.08
5.5.330.0100.03216.97
5.5.320.0070.02617.06
5.5.310.0060.02916.99
5.5.300.0070.03316.95
5.5.290.0110.03416.87
5.5.280.0060.03017.05
5.5.270.0080.03216.90
5.5.260.0080.03217.06
5.5.250.0040.02316.78
5.5.240.0060.01916.80
5.5.230.0090.01616.56
5.5.220.0060.01816.66
5.5.210.0070.03016.65
5.5.200.0050.03116.56
5.5.190.0090.02916.80
5.5.180.0030.02116.67
5.5.170.0070.00614.94
5.5.160.0060.01716.71
5.5.150.0050.03516.80
5.5.140.0100.02716.74
5.5.130.0100.01816.62
5.5.120.0040.02916.66
5.5.110.0050.03016.67
5.5.100.0060.02916.83
5.5.90.0040.01816.50
5.5.80.0030.03016.72
5.5.70.0100.01416.55
5.5.60.0070.02316.77
5.5.50.0080.02116.70
5.5.40.0040.03116.54
5.5.30.0070.02416.64
5.5.20.0040.03216.66
5.5.10.0040.02516.60
5.5.00.0060.03116.65

preferences:
64.41 ms | 401 KiB | 5 Q