3v4l.org

run code in 300+ PHP versions simultaneously
<?php //this seems to work as if there is 2 variables both a protected static and a protected non-static class foo { protected static $myvar = 999; //Uncommenting below leads to a Cannot redeclare foo::$myvar //public $myvar = 77; //Normal non-static Instance Functions public function __construct(){} public function instancePrintVar(){ echo __FUNCTION__.' '.$this->myvar; } public function instanceSetVar($v){ $this->myvar = $v; } //Static functions public static function staticPrintVar(){ echo __FUNCTION__.' '.self::$myvar; } public static function staticSetVar($v){ self::$myvar = $v; } } function nl(){ echo "\n"; } foo::staticPrintVar(); nl(); $foo = new foo(); $foo->instanceSetVar(3); $foo->instancePrintVar(); nl(); foo::staticPrintVar(); nl(); $foo::staticPrintVar(); nl(); echo "Conclusion: when using \$this-> to change the value, it adds another non-static version rather than changing the static version";

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.0120.00318.66
8.3.50.0130.00521.98
8.3.40.0090.00619.02
8.3.30.0000.01418.63
8.3.20.0030.00618.76
8.3.10.0040.00420.92
8.3.00.0030.00623.48
8.2.180.0150.00316.50
8.2.170.0120.00322.96
8.2.160.0070.01020.38
8.2.150.0050.00324.18
8.2.140.0030.00624.66
8.2.130.0080.00026.16
8.2.120.0070.00021.05
8.2.110.0060.00320.34
8.2.100.0000.01117.91
8.2.90.0000.00719.23
8.2.80.0060.00317.97
8.2.70.0040.00417.50
8.2.60.0000.00817.92
8.2.50.0040.00718.07
8.2.40.0000.00818.28
8.2.30.0000.00819.43
8.2.20.0080.00017.65
8.2.10.0050.00317.75
8.2.00.0040.00417.74
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0040.00422.47
8.1.230.0070.00420.90
8.1.220.0000.00818.77
8.1.210.0040.00419.10
8.1.200.0000.00817.48
8.1.190.0030.00517.41
8.1.180.0060.00318.10
8.1.170.0040.00418.58
8.1.160.0070.00018.74
8.1.150.0000.00818.57
8.1.140.0000.00717.35
8.1.130.0030.00317.79
8.1.120.0070.00017.42
8.1.110.0040.00417.38
8.1.100.0040.00417.30
8.1.90.0000.00717.28
8.1.80.0000.00717.34
8.1.70.0030.00317.34
8.1.60.0040.00417.57
8.1.50.0050.00217.46
8.1.40.0000.00717.51
8.1.30.0050.00317.53
8.1.20.0000.00917.61
8.1.10.0030.00617.57
8.1.00.0070.00417.35
8.0.300.0000.00719.80
8.0.290.0080.00017.16
8.0.280.0000.00718.49
8.0.270.0030.00517.29
8.0.260.0030.00316.79
8.0.250.0000.00816.97
8.0.240.0030.00616.98
8.0.230.0030.00316.89
8.0.220.0030.00717.02
8.0.210.0070.00016.91
8.0.200.0000.00816.91
8.0.190.0040.00417.06
8.0.180.0000.00817.00
8.0.170.0040.00416.89
8.0.160.0070.00016.87
8.0.150.0040.00416.82
8.0.140.0000.00916.93
8.0.130.0030.00313.38
8.0.120.0030.00616.94
8.0.110.0000.00816.77
8.0.100.0070.00016.95
8.0.90.0040.00416.91
8.0.80.0030.01016.79
8.0.70.0000.00716.71
8.0.60.0000.00816.84
8.0.50.0040.00416.76
8.0.30.0110.01117.15
8.0.20.0110.01017.41
8.0.10.0000.00716.81
8.0.00.0120.00716.81
7.4.330.0020.00216.83
7.4.320.0030.00316.41
7.4.300.0060.00016.59
7.4.290.0040.00416.48
7.4.280.0040.00316.50
7.4.270.0030.00316.66
7.4.260.0000.00513.33
7.4.250.0060.00316.56
7.4.240.0000.00716.61
7.4.230.0070.00016.48
7.4.220.0110.00516.44
7.4.210.0090.00616.54
7.4.200.0030.00516.60
7.4.190.0050.00216.66
7.4.160.0070.01016.55
7.4.150.0110.00717.40
7.4.140.0150.00717.86
7.4.130.0110.00816.54
7.4.120.0050.01116.51
7.4.110.0130.01016.56
7.4.100.0050.01916.73
7.4.90.0150.00316.45
7.4.80.0150.00619.39
7.4.70.0100.00716.63
7.4.60.0100.00716.55
7.4.50.0050.00516.35
7.4.40.0040.01122.77
7.4.30.0110.01016.62
7.4.10.0060.00915.05
7.4.00.0050.01215.08
7.3.330.0020.00213.29
7.3.320.0020.00213.19
7.3.310.0070.00016.48
7.3.300.0000.00716.38
7.3.290.0090.00616.41
7.3.280.0120.00616.40
7.3.270.0110.00617.40
7.3.260.0100.00818.24
7.3.250.0110.00716.51
7.3.240.0040.01316.43
7.3.230.0150.01016.58
7.3.210.0130.00916.28
7.3.200.0110.01119.39
7.3.190.0120.00416.56
7.3.180.0090.00616.43
7.3.170.0140.00316.48
7.3.160.0060.01016.41
7.3.130.0000.01214.66
7.3.120.0050.01215.02
7.3.110.0100.00715.00
7.3.100.0080.00815.10
7.3.90.0040.01114.55
7.3.80.0070.00714.70
7.3.70.0090.00614.70
7.3.60.0060.00614.67
7.3.50.0030.00714.82
7.3.40.0000.01214.67
7.3.30.0090.00015.00
7.3.20.0000.01016.74
7.3.10.0020.00916.45
7.3.00.0060.00516.64
7.2.330.0140.00316.76
7.2.320.0090.00916.49
7.2.310.0140.00416.50
7.2.300.0100.01416.81
7.2.290.0120.00616.77
7.2.260.0100.01015.07
7.2.250.0100.01014.91
7.2.240.0060.00915.27
7.2.230.0070.01115.20
7.2.220.0070.01115.20
7.2.210.0080.00814.96
7.2.200.0090.00015.10
7.2.190.0060.00614.88
7.2.180.0040.01114.88
7.2.170.0000.01215.01
7.2.160.0040.00714.99
7.2.150.0100.00716.70
7.2.140.0110.00416.86
7.2.130.0030.00616.85
7.2.120.0040.00716.90
7.2.110.0090.00616.78
7.2.100.0010.01116.92
7.2.90.0070.00717.03
7.2.80.0060.00617.05
7.2.70.0070.00916.70
7.2.60.0030.01216.93
7.2.50.0080.00516.84
7.2.40.0050.00616.98
7.2.30.0070.00716.93
7.2.20.0030.01217.02
7.2.10.0060.00617.08
7.2.00.0060.01017.78
7.1.330.0120.00315.65
7.1.320.0040.00815.76
7.1.310.0040.00715.85
7.1.300.0000.01215.82
7.1.290.0140.00015.45
7.1.280.0080.00415.67
7.1.270.0070.00315.60
7.1.260.0070.00715.75
7.1.250.0070.00515.61
7.1.240.0030.01015.79
7.1.230.0030.00615.96
7.1.220.0110.00315.78
7.1.210.0030.00915.86
7.1.200.0060.00515.69
7.1.190.0030.01015.57
7.1.180.0070.00715.49
7.1.170.0080.00815.71
7.1.160.0040.00815.85
7.1.150.0080.00415.65
7.1.140.0040.01115.80
7.1.130.0030.00715.53
7.1.120.0030.01415.84
7.1.110.0090.00615.73
7.1.100.0040.00715.68
7.1.90.0080.00415.57
7.1.80.0030.01015.77
7.1.70.0040.00816.31
7.1.60.0100.00316.59
7.1.50.0130.00716.34
7.1.40.0080.00415.62
7.1.30.0000.01715.77
7.1.20.0040.00815.62
7.1.10.0060.00615.72
7.1.00.0060.03018.93
7.0.330.0070.00315.40
7.0.320.0070.00715.30
7.0.310.0030.01315.49
7.0.300.0110.00415.26
7.0.290.0060.00315.52
7.0.280.0070.00415.41
7.0.270.0060.00315.54
7.0.260.0070.00715.20
7.0.250.0090.00615.33
7.0.240.0040.00915.47
7.0.230.0000.01115.44
7.0.220.0030.01015.22
7.0.210.0070.00415.54
7.0.200.0050.01415.96
7.0.190.0030.00815.56
7.0.180.0070.00415.42
7.0.170.0040.00815.43
7.0.160.0100.00315.19
7.0.150.0040.01115.50
7.0.140.0030.04518.69
7.0.130.0030.00615.52
7.0.120.0040.00815.53
7.0.110.0090.00615.43
7.0.100.0020.02917.70
7.0.90.0080.03917.74
7.0.80.0070.03417.64
7.0.70.0080.03217.65
7.0.60.0100.03017.80
7.0.50.0090.03417.88
7.0.40.0050.04316.84
7.0.30.0060.04616.76
7.0.20.0020.05316.76
7.0.10.0120.04116.65
7.0.00.0030.03816.70
5.6.400.0090.00614.59
5.6.390.0000.01214.27
5.6.380.0000.01214.52
5.6.370.0060.00614.56
5.6.360.0120.00314.58
5.6.350.0030.01014.27
5.6.340.0060.00914.48
5.6.330.0030.00914.63
5.6.320.0030.00714.50
5.6.310.0060.01014.69
5.6.300.0070.00714.34
5.6.290.0000.01214.57
5.6.280.0050.03717.65
5.6.270.0090.00014.46
5.6.260.0030.01014.16
5.6.250.0050.04217.63
5.6.240.0080.02817.56
5.6.230.0100.04017.61
5.6.220.0100.03917.50
5.6.210.0090.04417.60
5.6.200.0010.03317.88
5.6.190.0100.04217.65
5.6.180.0090.04217.91
5.6.170.0070.03217.74
5.6.160.0090.02317.69
5.6.150.0030.04817.63
5.6.140.0100.03817.88
5.6.130.0070.02717.76
5.6.120.0110.02617.80
5.6.110.0100.03417.74
5.6.100.0030.04317.65
5.6.90.0090.02617.76
5.6.80.0060.03217.44
5.6.70.0050.04517.36
5.6.60.0060.04017.37
5.6.50.0030.03217.35
5.6.40.0050.04717.23
5.6.30.0080.04517.35
5.6.20.0050.04217.29
5.6.10.0070.04017.42
5.6.00.0000.04717.43
5.5.380.0100.04117.43
5.5.370.0110.03517.24
5.5.360.0060.03317.48
5.5.350.0070.04417.43
5.5.340.0020.04917.59
5.5.330.0100.03417.45
5.5.320.0030.04417.65
5.5.310.0030.03817.61
5.5.300.0100.02317.40
5.5.290.0100.03817.54
5.5.280.0080.04017.71
5.5.270.0050.04717.61
5.5.260.0080.04317.37
5.5.250.0070.03417.44
5.5.240.0030.02717.30
5.5.230.0050.03217.25
5.5.220.0050.02817.03
5.5.210.0060.03917.28
5.5.200.0100.03917.16
5.5.190.0110.02317.28
5.5.180.0050.04117.09
5.5.170.0040.00914.27
5.5.160.0090.04017.36
5.5.150.0080.04217.04
5.5.140.0050.03517.23
5.5.130.0030.02817.27
5.5.120.0090.03317.26
5.5.110.0120.04017.24
5.5.100.0070.03017.26
5.5.90.0030.03417.33
5.5.80.0050.04617.07
5.5.70.0070.04217.29
5.5.60.0100.03817.04
5.5.50.0050.04017.21
5.5.40.0130.03717.20
5.5.30.0060.02617.23
5.5.20.0040.02517.38
5.5.10.0130.03917.18
5.5.00.0080.04317.25
5.4.450.0100.03815.14
5.4.440.0070.03915.21
5.4.430.0050.04015.39
5.4.420.0050.04315.26
5.4.410.0120.03515.19
5.4.400.0070.02414.93
5.4.390.0030.02915.13
5.4.380.0080.03715.21
5.4.370.0050.04215.01
5.4.360.0070.02315.04
5.4.350.0070.03915.18
5.4.340.0110.02115.22
5.4.330.0070.00011.29
5.4.320.0080.02315.24
5.4.310.0070.03715.03
5.4.300.0080.03714.92
5.4.290.0020.04514.88
5.4.280.0070.04014.99
5.4.270.0100.03715.06
5.4.260.0050.04315.05
5.4.250.0110.03815.17
5.4.240.0050.02514.88
5.4.230.0090.03514.82
5.4.220.0050.03014.95
5.4.210.0050.04115.20
5.4.200.0060.04114.93
5.4.190.0070.03815.03
5.4.180.0030.02414.98
5.4.170.0070.03315.02
5.4.160.0080.03515.10
5.4.150.0130.03015.05
5.4.140.0030.02713.81
5.4.130.0080.03513.69
5.4.120.0070.03713.86
5.4.110.0040.03513.79
5.4.100.0050.04113.98
5.4.90.0020.04613.75
5.4.80.0070.02113.71
5.4.70.0080.02813.84
5.4.60.0030.03213.86
5.4.50.0080.02413.71
5.4.40.0080.02213.58
5.4.30.0020.02713.62
5.4.20.0030.02813.75
5.4.10.0030.04313.85
5.4.00.0090.03513.51
5.3.290.0090.03512.71
5.3.280.0050.04012.69
5.3.270.0050.04112.79
5.3.260.0030.02412.61
5.3.250.0070.03212.64
5.3.240.0080.04012.59
5.3.230.0060.03312.63
5.3.220.0020.04212.48
5.3.210.0050.04312.48
5.3.200.0030.04112.59
5.3.190.0050.02512.56
5.3.180.0030.03312.49
5.3.170.0070.03812.58
5.3.160.0070.01712.59
5.3.150.0000.03412.63
5.3.140.0080.04712.54
5.3.130.0040.04312.54
5.3.120.0060.03612.61
5.3.110.0050.02512.41
5.3.100.0030.02512.38
5.3.90.0030.02312.38
5.3.80.0070.02212.26
5.3.70.0110.02512.21
5.3.60.0030.04512.32
5.3.50.0100.03712.20
5.3.40.0070.03812.22
5.3.30.0080.03812.27
5.3.20.0000.03012.16
5.3.10.0030.04211.97
5.3.00.0030.03012.02
5.2.170.0100.05013.68
5.2.160.0030.03313.68
5.2.150.0030.04313.68
5.2.140.0070.03313.68
5.2.130.0070.05313.68
5.2.120.0030.05013.68
5.2.110.0030.03313.68
5.2.100.0000.03313.68
5.2.90.0070.06313.68
5.2.80.0030.07013.68
5.2.70.0100.05713.68
5.2.60.0070.03313.68
5.2.50.0070.03013.68
5.2.40.0070.05313.68
5.2.30.0100.02713.68
5.2.20.0070.05013.68
5.2.10.0070.05713.68
5.2.00.0100.05313.68
5.1.60.0030.03313.68
5.1.50.0100.05013.68
5.1.40.0000.04713.68
5.1.30.0030.03313.68
5.1.20.0070.05713.68
5.1.10.0000.05713.68
5.1.00.0100.05013.68
5.0.50.0000.03013.68
5.0.40.0000.03713.68
5.0.30.0070.05013.68
5.0.20.0000.03013.68
5.0.10.0000.02713.68
5.0.00.0000.06713.68
4.4.90.0070.03313.68
4.4.80.0030.02313.68
4.4.70.0070.03313.68
4.4.60.0030.03313.68
4.4.50.0100.02713.68
4.4.40.0070.04313.68
4.4.30.0100.03013.68
4.4.20.0030.02313.68
4.4.10.0000.03013.68
4.4.00.0000.05013.68
4.3.110.0100.02313.68
4.3.100.0070.02713.68
4.3.90.0030.02313.68
4.3.80.0000.04313.68
4.3.70.0030.02013.68
4.3.60.0030.03013.68
4.3.50.0000.03713.68
4.3.40.0030.05013.68
4.3.30.0030.01713.68
4.3.20.0030.02313.68
4.3.10.0070.02013.68
4.3.00.0030.03013.68

preferences:
55.23 ms | 400 KiB | 5 Q