3v4l.org

run code in 300+ PHP versions simultaneously
<?php class c { protected $type = null; public function __construct($in) { $this->type = $in; } public function __toString() { return $this->type; } static function getInstanceA() { static $a = null; if ($a === null) { $a = new c('A'); } return $a; } static function getInstanceB() { static $b = null; if ($b === null) { $b = new c('B'); } return $b; } static function someA() { static $a = null; $a = 'this is fucked'; } } $my_a = c::getInstanceA(); $my_b = c::getInstanceB(); c::someA(); echo $my_a; echo $my_b;

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.40.0120.00318.73
8.3.30.0070.00719.08
8.3.20.0050.00320.21
8.3.10.0000.00820.46
8.3.00.0030.00719.38
8.2.170.0070.00722.96
8.2.160.0100.00620.39
8.2.150.0030.00524.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0040.00421.09
8.2.110.0100.00019.18
8.2.100.0080.00317.78
8.2.90.0080.00019.22
8.2.80.0080.00017.97
8.2.70.0000.01017.63
8.2.60.0000.00817.80
8.2.50.0030.00618.07
8.2.40.0070.00318.09
8.2.30.0000.00719.38
8.2.20.0050.00217.77
8.2.10.0070.00018.20
8.2.00.0050.00317.75
8.1.270.0040.00423.96
8.1.260.0030.00526.35
8.1.250.0060.00328.09
8.1.240.0070.00321.06
8.1.230.0090.00317.52
8.1.220.0000.00817.88
8.1.210.0040.00418.77
8.1.200.0040.00817.35
8.1.190.0000.00817.23
8.1.180.0070.00018.10
8.1.170.0000.00818.64
8.1.160.0000.00722.07
8.1.150.0040.00418.78
8.1.140.0050.00217.39
8.1.130.0000.00717.83
8.1.120.0040.00417.50
8.1.110.0050.00217.47
8.1.100.0040.00417.42
8.1.90.0090.00017.48
8.1.80.0080.00017.48
8.1.70.0000.00717.44
8.1.60.0040.00417.59
8.1.50.0040.00417.41
8.1.40.0040.00417.45
8.1.30.0040.00417.64
8.1.20.0040.00417.71
8.1.10.0000.00717.56
8.1.00.0050.00317.57
8.0.300.0040.00418.77
8.0.290.0030.00516.75
8.0.280.0050.00318.41
8.0.270.0030.00317.27
8.0.260.0060.00017.27
8.0.250.0030.00316.95
8.0.240.0080.00016.97
8.0.230.0000.00716.86
8.0.220.0070.00016.87
8.0.210.0000.00716.79
8.0.200.0020.00516.96
8.0.190.0030.00516.93
8.0.180.0000.00716.89
8.0.170.0060.00316.96
8.0.160.0000.00816.85
8.0.150.0000.00716.85
8.0.140.0070.00016.84
8.0.130.0070.00013.27
8.0.120.0100.00016.77
8.0.110.0000.00816.93
8.0.100.0040.00416.76
8.0.90.0030.00516.96
8.0.80.0070.01416.90
8.0.70.0000.00716.92
8.0.60.0040.00416.74
8.0.50.0070.00016.90
8.0.30.0100.01017.05
8.0.20.0130.00717.40
8.0.10.0040.00416.92
8.0.00.0080.01116.85
7.4.330.0000.00615.09
7.4.320.0000.00616.61
7.4.300.0030.00316.52
7.4.290.0000.00816.52
7.4.280.0040.00416.53
7.4.270.0000.00716.54
7.4.260.0030.00616.61
7.4.250.0040.00416.63
7.4.240.0020.00516.61
7.4.230.0030.00316.52
7.4.220.0110.00716.54
7.4.210.0130.01016.45
7.4.200.0000.00716.65
7.4.160.0140.00516.63
7.4.150.0110.00717.40
7.4.140.0070.01017.86
7.4.130.0060.01116.42
7.4.120.0080.01216.60
7.4.110.0100.00616.40
7.4.100.0100.00716.57
7.4.90.0100.00716.56
7.4.80.0130.00319.39
7.4.70.0120.00616.65
7.4.60.0040.01216.59
7.4.50.0060.00316.57
7.4.40.0070.01116.53
7.4.30.0080.00816.55
7.4.00.0040.01114.84
7.3.330.0030.00313.23
7.3.320.0030.00313.12
7.3.310.0000.00716.31
7.3.300.0000.00616.32
7.3.290.0000.02016.38
7.3.280.0060.01016.28
7.3.270.0070.01017.40
7.3.260.0110.00616.21
7.3.250.0060.01016.36
7.3.240.0100.00716.50
7.3.230.0180.00616.55
7.3.210.0140.00516.30
7.3.200.0080.01119.39
7.3.190.0070.01516.45
7.3.180.0100.00716.31
7.3.170.0130.00616.39
7.3.160.0040.01716.37
7.2.330.0090.01016.63
7.2.320.0070.01016.85
7.2.310.0070.01016.64
7.2.300.0070.01116.74
7.2.290.0030.01316.57
7.2.60.0000.01117.03
7.2.00.0040.00819.00
7.1.200.0050.00215.52
7.1.100.0000.01518.20
7.1.70.0050.00316.97
7.1.60.0100.01419.61
7.1.50.0060.01616.65
7.1.00.0030.07722.33
7.0.200.0000.01016.79
7.0.140.0030.06722.11
7.0.60.0100.06020.05
7.0.50.0130.05017.86
7.0.40.0070.08020.02
7.0.30.0200.06720.07
7.0.20.0400.06020.30
7.0.10.0070.05720.30
7.0.00.0030.07020.13
5.6.280.0030.06721.03
5.6.210.0100.06720.68
5.6.200.0070.09018.16
5.6.190.0000.05020.77
5.6.180.0600.03720.47
5.6.170.0330.07020.48
5.6.160.0000.09320.57
5.6.150.0100.06018.15
5.6.140.0030.08018.19
5.6.130.0000.05018.14
5.6.120.0070.04320.75
5.6.110.0030.08321.14
5.6.100.0100.08020.98
5.6.90.0100.08021.04
5.6.80.0170.07320.52
5.5.350.0170.06020.44
5.5.340.0170.07318.04
5.5.330.0170.03020.41
5.5.320.0230.04720.14
5.5.310.0200.08320.27
5.5.300.0030.09017.92
5.5.290.0100.08018.02
5.5.280.0030.09021.00
5.5.270.0100.08320.87
5.5.260.0070.08320.78
5.5.250.0130.06720.50
5.5.240.0170.07720.30
5.4.450.0100.04719.49
5.4.440.0070.05019.52
5.4.430.0100.04019.19
5.4.420.0100.05319.55
5.4.410.0100.05019.07
5.4.400.0030.04718.84
5.4.390.0300.03019.09
5.4.380.0370.06718.84
5.4.370.0370.05318.52
5.4.360.0400.06018.52
5.4.350.0330.05318.63
5.4.340.0270.05718.57
5.4.320.0100.03412.50
5.4.310.0090.04912.50
5.4.300.0060.04012.51
5.4.290.0070.03812.50
5.4.280.0090.03312.40
5.4.270.0100.04212.40
5.4.260.0060.04112.40
5.4.250.0080.04112.40
5.4.240.0070.03512.40
5.4.230.0090.04012.39
5.4.220.0090.03512.39
5.4.210.0090.04912.39
5.4.200.0080.04412.40
5.4.190.0080.03412.39
5.4.180.0090.04412.39
5.4.170.0070.03712.40
5.4.160.0070.03712.39
5.4.150.0090.04012.39
5.4.140.0100.03312.07
5.4.130.0060.04012.07
5.4.120.0050.04012.02
5.4.110.0040.03712.02
5.4.100.0050.03612.02
5.4.90.0050.03812.02
5.4.80.0110.04112.02
5.4.70.0070.03612.02
5.4.60.0080.04412.02
5.4.50.0030.03712.02
5.4.40.0070.04012.01
5.4.30.0040.03712.00
5.4.20.0060.03612.00
5.4.10.0040.04412.00
5.4.00.0020.04011.49
5.3.290.0090.04112.80
5.3.280.0060.04312.71
5.3.270.0060.04212.72
5.3.260.0060.04612.72
5.3.250.0090.03812.72
5.3.240.0100.03612.72
5.3.230.0070.03712.71
5.3.220.0110.03212.68
5.3.210.0050.04312.68
5.3.200.0100.03212.68
5.3.190.0080.04012.68
5.3.180.0040.03712.67
5.3.170.0070.03512.67
5.3.160.0090.03412.67
5.3.150.0110.03912.67
5.3.140.0100.04312.66
5.3.130.0060.03712.66
5.3.120.0100.04512.66
5.3.110.0080.03712.66
5.3.100.0060.04012.13
5.3.90.0110.03712.11
5.3.80.0050.04112.11
5.3.70.0090.03412.10
5.3.60.0100.03312.09
5.3.50.0080.04012.03
5.3.40.0050.04112.03
5.3.30.0040.04411.99
5.3.20.0050.03711.77
5.3.10.0090.03211.74
5.3.00.0030.04011.73
5.2.170.0060.0289.23
5.2.160.0050.0319.23
5.2.150.0050.0319.23
5.2.140.0040.0319.22
5.2.130.0040.0299.18
5.2.120.0020.0349.18
5.2.110.0050.0389.19
5.2.100.0070.0299.19
5.2.90.0080.0349.19
5.2.80.0070.0309.18
5.2.70.0060.0289.18
5.2.60.0060.0359.14
5.2.50.0050.0299.11
5.2.40.0080.0269.08
5.2.30.0020.0319.06
5.2.20.0050.0359.05
5.2.10.0050.0278.95
5.2.00.0040.0338.81
5.1.60.0020.0318.10
5.1.50.0030.0298.10
5.1.40.0050.0308.07
5.1.30.0060.0268.42
5.1.20.0060.0258.45
5.1.10.0050.0248.18
5.1.00.0070.0328.17
5.0.50.0030.0216.66
5.0.40.0050.0196.52
5.0.30.0050.0306.33
5.0.20.0040.0226.29
5.0.10.0020.0216.27
5.0.00.0020.0326.27
4.4.90.0020.0164.77
4.4.80.0020.0154.75
4.4.70.0040.0144.75
4.4.60.0050.0154.76
4.4.50.0020.0174.77
4.4.40.0040.0284.71
4.4.30.0040.0184.76
4.4.20.0050.0154.84
4.4.10.0050.0184.85
4.4.00.0020.0264.76
4.3.110.0010.0174.67
4.3.100.0040.0134.67
4.3.90.0040.0134.64
4.3.80.0020.0254.58
4.3.70.0010.0164.63
4.3.60.0030.0144.62
4.3.50.0020.0164.62
4.3.40.0020.0254.54
4.3.30.0030.0193.30
4.3.20.0010.0203.28
4.3.10.0030.0183.24
4.3.00.0000.01318.16

preferences:
45.8 ms | 400 KiB | 5 Q