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 = $mv; } //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.0040.01118.56
8.3.50.0220.00821.84
8.3.40.0000.01518.51
8.3.30.0140.00019.09
8.3.20.0000.00720.33
8.3.10.0040.00422.10
8.3.00.0000.00922.30
8.2.180.0090.00616.88
8.2.170.0070.01022.96
8.2.160.0070.01020.95
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0040.00421.07
8.2.110.0060.00320.89
8.2.100.0060.00617.91
8.2.90.0040.00417.97
8.2.80.0040.00417.97
8.2.70.0080.00017.63
8.2.60.0000.00718.03
8.2.50.0030.00518.07
8.2.40.0070.00018.02
8.2.30.0000.01018.12
8.2.20.0060.00317.77
8.2.10.0000.00819.41
8.2.00.0040.00717.74
8.1.280.0140.00025.92
8.1.270.0040.00422.05
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0200.00023.70
8.1.230.0040.00820.95
8.1.220.0080.00017.74
8.1.210.0050.00318.91
8.1.200.0060.00317.38
8.1.190.0040.00417.53
8.1.180.0030.00518.10
8.1.170.0000.00818.61
8.1.160.0000.00721.85
8.1.150.0090.00018.56
8.1.140.0030.00517.41
8.1.130.0030.00317.82
8.1.120.0000.00717.30
8.1.110.0000.00717.34
8.1.100.0040.00417.43
8.1.90.0000.00717.38
8.1.80.0000.00717.30
8.1.70.0030.00617.32
8.1.60.0030.00517.62
8.1.50.0090.00017.51
8.1.40.0040.00417.54
8.1.30.0040.00417.66
8.1.20.0040.00417.49
8.1.10.0050.00317.47
8.1.00.0000.00717.52
8.0.300.0000.00720.07
8.0.290.0000.00717.05
8.0.280.0000.00818.43
8.0.270.0030.00317.13
8.0.260.0030.00316.84
8.0.250.0000.00717.05
8.0.240.0040.00417.00
8.0.230.0070.00017.08
8.0.220.0030.00316.94
8.0.210.0000.00716.89
8.0.200.0030.00316.96
8.0.190.0030.00616.92
8.0.180.0000.00717.01
8.0.170.0040.00416.99
8.0.160.0070.00016.79
8.0.150.0020.00516.88
8.0.140.0000.00716.82
8.0.130.0050.00013.38
8.0.120.0000.00716.88
8.0.110.0050.00316.79
8.0.100.0000.00716.82
8.0.90.0000.00716.84
8.0.80.0060.00916.81
8.0.70.0000.00716.71
8.0.60.0000.00716.93
8.0.50.0050.00316.79
8.0.30.0090.00917.04
8.0.20.0130.00717.40
8.0.10.0040.00416.86
8.0.00.0110.01316.81
7.4.330.0030.00215.00
7.4.320.0060.00016.42
7.4.300.0030.00316.48
7.4.290.0070.00016.43
7.4.280.0030.00316.40
7.4.270.0060.00316.46
7.4.260.0000.00716.48
7.4.250.0000.00716.38
7.4.240.0040.00416.47
7.4.230.0000.00716.31
7.4.220.0100.00716.54
7.4.210.0080.00716.58
7.4.200.0000.00716.36
7.4.190.0000.00716.66
7.4.160.0150.00016.64
7.4.150.0100.01417.40
7.4.140.0110.00717.86
7.4.130.0120.00916.57
7.4.120.0110.00816.57
7.4.110.0110.00716.62
7.4.100.0070.01016.61
7.4.90.0120.00916.55
7.4.80.0030.01416.48
7.4.70.0160.00616.63
7.4.60.0030.01316.61
7.4.50.0040.00416.54
7.4.40.0100.00322.77
7.4.30.0070.00716.52
7.4.00.0030.00914.92
7.3.330.0030.00313.40
7.3.320.0020.00213.35
7.3.310.0040.00416.32
7.3.300.0060.00016.30
7.3.290.0130.00616.43
7.3.280.0090.00716.41
7.3.270.0030.01417.40
7.3.260.0150.00316.52
7.3.250.0120.00816.53
7.3.240.0140.00316.41
7.3.230.0080.00816.60
7.3.210.0110.00716.56
7.3.200.0030.00419.39
7.3.190.0130.01016.29
7.3.180.0100.01016.65
7.3.170.0030.01216.37
7.3.160.0040.01216.58
7.3.120.0000.01814.88
7.2.330.0070.01016.70
7.2.320.0130.00316.74
7.2.310.0100.00716.75
7.2.300.0050.01316.44
7.2.290.0030.01216.79
7.2.60.0070.00716.95
7.2.00.0070.00419.19
7.1.200.0000.01315.64
7.1.100.0080.00318.09
7.1.70.0090.00316.59
7.1.60.0070.01719.82
7.1.50.0230.01034.66
7.1.00.0030.07322.44
7.0.200.0100.00316.73
7.0.140.0030.07322.00
7.0.60.0170.07320.07
7.0.50.0100.08317.89
7.0.40.0070.04320.27
7.0.30.0330.07320.09
7.0.20.0300.07320.12
7.0.10.0100.09020.08
7.0.00.0170.08020.23
5.6.280.0070.07021.11
5.6.210.0030.08720.62
5.6.200.0130.07718.16
5.6.190.0070.04020.52
5.6.180.0030.04020.61
5.6.170.0200.04720.55
5.6.160.0000.04320.50
5.6.150.0000.04018.23
5.6.140.0070.05718.24
5.6.130.0030.08318.18
5.6.120.0170.06020.99
5.6.110.0200.04721.14
5.6.100.0200.05720.99
5.6.90.0070.07321.14
5.6.80.0100.08320.52
5.5.350.0000.05720.30
5.5.340.0170.07317.97
5.5.330.0100.08020.40
5.5.320.0070.08020.35
5.5.310.0270.07020.29
5.5.300.0070.07317.94
5.5.290.0130.07317.92
5.5.280.0000.06320.89
5.5.270.0070.08720.84
5.5.260.0070.07720.96
5.5.250.0070.03720.63
5.5.240.0000.04020.07
5.4.450.0100.03719.55
5.4.440.1700.03319.39
5.4.430.2000.04019.44
5.4.420.2100.03319.43
5.4.410.1670.04719.19
5.4.400.1830.03319.23
5.4.390.2000.04019.06
5.4.380.2030.04018.84
5.4.370.1770.05319.18
5.4.360.1930.05019.06
5.4.350.2070.04018.95
5.4.340.1970.04319.20
5.4.320.1370.04719.16
5.4.310.0030.03718.84
5.4.300.0070.04319.31
5.4.290.0130.06019.30
5.4.280.1500.03719.09
5.4.270.1830.03318.84
5.4.260.1900.03019.19
5.4.250.1930.03719.21
5.4.240.1930.04719.09
5.4.230.1930.04019.12
5.4.220.2030.04719.12
5.4.210.1900.04018.87
5.4.200.1700.04318.87
5.4.190.1730.04019.07
5.4.180.2070.04319.14
5.4.170.1830.03718.90
5.4.160.2070.04719.20
5.4.150.1970.04019.14
5.4.140.1930.03316.41
5.4.130.2100.03016.76
5.4.120.1900.03016.40
5.4.110.2030.04716.50
5.4.100.1830.03716.59
5.4.90.1830.03016.61
5.4.80.1530.02716.44
5.4.70.0100.04716.39
5.4.60.0130.04016.43
5.4.50.1730.03016.23
5.4.40.1730.04016.23
5.4.30.2070.04016.44
5.4.20.2030.04016.51
5.4.10.1900.03716.26
5.4.00.2170.03716.00
5.3.290.2130.03714.68
5.3.280.2170.04314.68
5.3.270.2070.05014.54
5.3.260.2130.04714.52
5.3.250.2000.04014.62
5.3.240.2100.04714.52
5.3.230.2170.03314.75
5.3.220.1830.03714.56
5.3.210.1830.04014.54
5.3.200.1870.03714.47
5.3.190.1970.04314.63
5.3.180.1870.03314.54
5.3.170.1970.03314.55
5.3.160.1800.04014.66
5.3.150.1930.04014.63
5.3.140.0070.07714.57
5.3.130.0000.06314.47
5.3.120.0870.05314.70
5.3.110.1800.04014.63
5.3.100.1800.03714.06
5.3.90.2030.04013.94
5.3.80.1730.04014.05
5.3.70.1570.03314.03
5.3.60.1770.04014.23
5.3.50.1630.03014.04
5.3.40.1800.03713.89
5.3.30.1700.04714.00
5.3.20.1770.02713.73
5.3.10.1270.03713.73
5.3.00.0030.04313.55
5.2.170.0030.03011.14
5.2.160.0000.03011.05
5.2.150.0530.03711.13
5.2.140.1300.03311.21
5.2.130.1530.03311.12
5.2.120.1330.03011.35
5.2.110.1400.02311.04
5.2.100.1330.03311.09
5.2.90.1630.03311.02
5.2.80.1800.03011.06
5.2.70.1670.02011.01
5.2.60.1200.03011.17
5.2.50.1300.02011.17
5.2.40.0770.03011.12
5.2.30.1200.02311.07
5.2.20.1130.02310.95
5.2.10.1230.03310.83
5.2.00.1100.02310.70
5.1.60.1230.0209.93
5.1.50.1230.0239.91
5.1.40.1030.02710.07
5.1.30.1270.02010.41
5.1.20.1330.02310.27
5.1.10.1230.0239.96
5.1.00.1070.02710.06
5.0.50.0630.0238.69
5.0.40.0830.0278.41
5.0.30.0600.0308.24
5.0.20.0770.0278.44
5.0.10.0770.0338.17
5.0.00.0800.0478.17
4.4.90.0800.0237.96
4.4.80.0800.0177.96
4.4.70.0600.0177.96
4.4.60.0730.0137.96
4.4.50.0770.0237.96
4.4.40.0770.0407.96
4.4.30.0670.0177.96
4.4.20.0670.0207.96
4.4.10.0770.0307.96
4.4.00.0530.0277.96
4.3.110.0830.0207.96
4.3.100.0800.0177.96
4.3.90.0670.0177.96
4.3.80.0730.0407.96
4.3.70.0830.0207.96
4.3.60.0730.0207.96
4.3.50.0700.0177.96
4.3.40.0900.0307.96
4.3.30.0300.0177.96
4.3.20.0400.0277.96
4.3.10.0300.0237.96
4.3.00.0370.0137.96

preferences:
38.62 ms | 401 KiB | 5 Q