3v4l.org

run code in 300+ PHP versions simultaneously
<?php // 费了我好大功夫, 把这些都总结到一个例子里面了 // PHP5.0 - PHP5.5 测试通过 class A { //类常量 const constValue = "constValue\n"; //类属性 public $property = "properties\n"; //静态属性 static public $staticProperty = "staticProperty\n"; //普通函数 public function func() { } //静态函数 static public function staticFunc() { } } $xxoo = new A; //访问实例的属性 print $xxoo->property; //访问实例的函数 print $xxoo->func(); //也可以借助实例来访问静态成员 print $xxoo->staticFunc(); //如果不借助实例,那就直接用类名加双冒号 print A::staticFunc(); print A::constValue; //静态属性要加美元符号 print A::$staticProperty; //继承类A class B extends A { //覆盖父类的属性 public $property = "covered-properties\n"; //覆盖父类的静态属性 static public $staitcProperty = "covered-staitcProperties\n"; //覆盖父类的函数 public function func() { //访问自己的属性 print $this->property; //访问从父类继承来的静态属性 print self::$staticProperty; //强制指定访问父类(而不是自己)的属性 print parent::$property; //强制指定访问父类(而不是自己)的函数 print parent::func(); } //覆盖父类的静态函数 static public function staticFunc() { //因为没有$this, 所以用self访问自己的静态属性 print self::$staitcProperty; //强制访问父类的静态属性 print parent::$staitcProperty; } } //运行一下上面的例子 $xxoo = new B; $xxoo->func(); B::staticFunc();

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.70.0120.00616.63
8.3.60.0140.00316.63
8.3.50.0100.00617.31
8.3.40.0070.00718.84
8.3.30.0110.00418.70
8.3.20.0050.00318.77
8.3.10.0080.00018.76
8.3.00.0060.00319.15
8.2.180.0070.00718.29
8.2.170.0070.01322.96
8.2.160.0070.00720.44
8.2.150.0030.00624.18
8.2.140.0060.00324.66
8.2.130.0070.00026.16
8.2.120.0000.00819.48
8.2.110.0080.00019.45
8.2.100.0110.00618.03
8.2.90.0000.00817.88
8.2.80.0040.00418.91
8.2.70.0080.00017.93
8.2.60.0050.00517.92
8.2.50.0040.00418.10
8.2.40.0000.00919.28
8.2.30.0040.00419.46
8.2.20.0030.00617.76
8.2.10.0000.00717.65
8.2.00.0000.00817.73
8.1.280.0140.00725.92
8.1.270.0040.00424.66
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0070.00322.13
8.1.230.0000.01220.96
8.1.220.0000.00818.64
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0040.00417.23
8.1.180.0080.00018.10
8.1.170.0000.00818.49
8.1.160.0070.00018.80
8.1.150.0050.00218.67
8.1.140.0080.00017.32
8.1.130.0030.00317.85
8.1.120.0020.00517.36
8.1.110.0040.00417.45
8.1.100.0070.00017.44
8.1.90.0030.00617.43
8.1.80.0070.00017.43
8.1.70.0030.00317.37
8.1.60.0040.00417.62
8.1.50.0000.00817.47
8.1.40.0000.00817.54
8.1.30.0030.00617.71
8.1.20.0080.00017.70
8.1.10.0000.00817.51
8.1.00.0040.00417.51
8.0.300.0060.00319.85
8.0.290.0030.00616.75
8.0.280.0070.00018.41
8.0.270.0070.00017.39
8.0.260.0030.00316.91
8.0.250.0080.00017.00
8.0.240.0040.00416.95
8.0.230.0000.00716.95
8.0.220.0030.00316.95
8.0.210.0050.00216.92
8.0.200.0030.00316.90
8.0.190.0000.00716.89
8.0.180.0060.00316.80
8.0.170.0030.00616.78
8.0.160.0050.00316.92
8.0.150.0030.00516.89
8.0.140.0030.00616.75
8.0.130.0030.00313.43
8.0.120.0000.00716.85
8.0.110.0000.00816.98
8.0.100.0030.00516.86
8.0.90.0040.00416.86
8.0.80.0150.00316.91
8.0.70.0050.00216.74
8.0.60.0080.00016.94
8.0.50.0000.00716.92
8.0.30.0060.01217.11
8.0.20.0050.01217.17
8.0.10.0000.00717.07
8.0.00.0120.00616.93
7.4.330.0000.00512.94
7.4.320.0030.00316.39
7.4.300.0030.00316.45
7.4.290.0000.00716.63
7.4.280.0040.00416.51
7.4.270.0000.00716.61
7.4.260.0060.00013.29
7.4.250.0030.00616.51
7.4.240.0000.00716.43
7.4.230.0030.00316.63
7.4.220.0150.00916.71
7.4.210.0100.00616.56
7.4.200.0080.00016.63
7.4.190.0080.00016.72
7.4.160.0060.00916.50
7.4.150.0030.01416.47
7.4.140.0100.00816.56
7.4.130.0090.00816.53
7.4.120.0090.01016.54
7.4.110.0030.01416.56
7.4.100.0110.00516.50
7.4.90.0050.01416.39
7.4.80.0090.00916.50
7.4.70.0140.00316.60
7.4.60.0130.00616.49
7.4.50.0090.00016.36
7.4.40.0040.01116.62
7.4.30.0060.01316.59
7.4.00.0030.01215.22
7.3.330.0060.00013.31
7.3.320.0060.00013.34
7.3.310.0000.00716.18
7.3.300.0000.00716.31
7.3.290.0060.01216.35
7.3.280.0050.01116.38
7.3.270.0130.00316.56
7.3.260.0070.01016.46
7.3.250.0110.00816.48
7.3.240.0100.00716.28
7.3.230.0100.00716.55
7.3.210.0100.01316.30
7.3.200.0120.00519.39
7.3.190.0140.00316.43
7.3.180.0130.00316.40
7.3.170.0110.00416.49
7.3.160.0100.00516.40
7.3.120.0030.01314.82
7.3.110.0060.00914.53
7.3.100.0070.01014.88
7.3.90.0060.00614.70
7.3.80.0060.00914.89
7.3.70.0100.00314.72
7.3.60.0070.00714.85
7.3.50.0140.00014.52
7.3.40.0060.00614.82
7.3.30.0080.00814.61
7.3.20.0060.00816.71
7.3.10.0080.00816.53
7.3.00.0110.00316.43
7.2.330.0070.01116.26
7.2.320.0060.01216.66
7.2.310.0160.00316.63
7.2.300.0060.01216.80
7.2.290.0080.00916.32
7.2.240.0030.00915.21
7.2.230.0060.00615.30
7.2.220.0030.01014.75
7.2.210.0060.00914.63
7.2.200.0030.01215.07
7.2.190.0030.01414.72
7.2.180.0110.00015.22
7.2.170.0100.00614.98
7.2.160.0060.01014.68
7.2.150.0070.01117.04
7.2.140.0090.00616.89
7.2.130.0030.01416.97
7.2.120.0080.00816.89
7.2.110.0100.00516.96
7.2.100.0020.01216.80
7.2.90.0080.00616.96
7.2.80.0040.00816.92
7.2.70.0030.01016.95
7.2.60.0060.00716.85
7.2.50.0030.01216.92
7.2.40.0020.01016.95
7.2.30.0050.01117.04
7.2.20.0090.00916.80
7.2.10.0080.00516.89
7.2.00.0020.01317.68
7.1.330.0000.00815.97
7.1.320.0110.00415.56
7.1.310.0000.01715.84
7.1.300.0030.01015.68
7.1.290.0130.00315.54
7.1.280.0070.01115.57
7.1.270.0030.01415.59
7.1.260.0030.01315.76
7.1.250.0050.00815.78
7.1.200.0360.00015.50
7.1.100.0060.00318.24
7.1.70.0030.00617.13
7.1.60.0040.00719.40
7.1.50.0030.01916.93
7.1.00.0030.06722.57
7.0.200.0100.00714.80
7.0.140.0030.07022.10
7.0.120.0000.07322.13
7.0.60.0100.07020.04
7.0.50.0130.08017.86
7.0.40.0200.07320.23
7.0.30.0300.07720.30
7.0.20.0230.07720.19
7.0.10.0070.05720.24
7.0.00.0130.06720.30
5.6.280.0070.07020.93
5.6.210.0030.08020.54
5.6.200.0000.07318.28
5.6.190.0000.04720.47
5.6.180.0100.04320.53
5.6.170.0300.07020.47
5.6.160.0200.07020.41
5.6.150.0030.06718.16
5.6.140.0030.08318.18
5.6.130.0070.08318.28
5.6.120.0100.03321.15
5.6.110.0000.06321.18
5.6.100.0130.08021.01
5.6.90.0130.07721.13
5.6.80.0030.08720.29
5.5.350.0000.03720.45
5.5.340.0070.08017.96
5.5.330.0030.04320.13
5.5.320.0400.06720.32
5.5.310.0200.04320.34
5.5.300.0230.03717.97
5.5.290.0000.07317.98
5.5.280.0070.06720.79
5.5.270.0030.04320.77
5.5.260.0130.07020.79
5.5.250.0030.05020.63
5.5.240.0300.06320.25
5.4.450.0030.06719.40
5.4.440.0070.06019.18
5.4.430.0000.04319.17
5.4.420.0070.05019.47
5.4.410.0170.07019.07
5.4.400.0100.03018.93
5.4.390.0030.05019.00
5.4.380.0030.04719.01
5.4.370.0100.06718.86
5.4.360.0070.03719.24
5.4.350.0030.07719.13
5.4.340.0000.04319.20
5.4.320.0030.04719.20
5.4.310.0070.06019.14
5.4.300.0030.05019.16
5.4.290.0130.07318.97
5.4.280.0070.07719.14
5.4.270.0030.07719.14
5.4.260.0070.08319.13
5.4.250.0030.07019.14
5.4.240.0030.05718.97
5.4.230.0200.06319.25
5.4.220.0100.07019.23
5.4.210.0070.05719.14
5.4.200.0030.05319.15
5.4.190.0130.05319.07
5.4.180.0130.07318.96
5.4.170.0070.04718.84
5.4.160.0070.06019.12
5.4.150.0030.04318.83
5.4.140.0070.03316.47
5.4.130.0100.06016.47
5.4.120.0030.06016.47
5.4.110.0070.07316.49
5.4.100.0030.04016.48
5.4.90.0130.07016.48
5.4.80.0030.04016.33
5.4.70.0030.05016.57
5.4.60.0100.06016.47
5.4.50.0070.05016.27
5.4.40.0070.07716.40
5.4.30.0030.07016.52
5.4.20.0030.06716.69
5.4.10.0070.07016.27
5.4.00.0030.04015.95
5.3.290.0070.05314.72
5.3.280.0230.05714.62
5.3.270.0000.08014.69
5.3.260.0070.04014.62
5.3.250.0100.04014.67
5.3.240.0030.05014.62
5.3.230.0030.04314.62
5.3.220.0070.07014.60
5.3.210.0030.05314.59
5.3.200.0100.04314.65
5.3.190.0130.07314.65
5.3.180.0100.06714.57
5.3.170.0070.07714.72
5.3.160.0070.07314.64
5.3.150.0100.06014.60
5.3.140.0100.07014.71
5.3.130.0030.05714.71
5.3.120.0070.07014.61
5.3.110.0130.07014.55
5.3.100.0070.04014.04
5.3.90.0130.06714.06
5.3.80.0070.07313.97
5.3.70.0030.08014.07
5.3.60.0070.04714.04
5.3.50.0030.04013.84
5.3.40.0070.05713.92
5.3.30.0030.03713.93
5.3.20.0130.07013.65
5.3.10.0070.03313.82
5.3.00.0070.07013.72
5.2.170.0030.06311.20
5.2.160.0070.04711.16
5.2.150.0030.05711.31
5.2.140.0000.04011.04
5.2.130.0070.03311.19
5.2.120.0070.05711.19
5.2.110.0070.04311.17
5.2.100.0200.01711.11
5.2.90.0070.06311.11
5.2.80.0030.05711.16
5.2.70.0030.04311.07
5.2.60.0000.04011.05
5.2.50.0070.04711.04
5.2.40.0030.04011.07
5.2.30.0070.03311.03
5.2.20.0100.05011.02
5.2.10.0070.06010.88
5.2.00.0100.05710.69
5.1.60.0030.04010.07
5.1.50.0070.02310.07
5.1.40.0070.04010.04
5.1.30.0000.04310.42
5.1.20.0100.05310.25
5.1.10.0070.04310.22
5.1.00.0030.0379.99
5.0.50.0030.0438.59
5.0.40.0000.0478.39
5.0.30.0030.0678.23
5.0.20.0030.0308.26
5.0.10.0030.0208.20
5.0.00.0000.0408.08
4.4.90.0000.0207.90
4.4.80.0000.0177.90
4.4.70.0030.0137.90
4.4.60.0000.0207.90
4.4.50.0100.0277.90
4.4.40.0100.0237.90
4.4.30.0000.0377.90
4.4.20.0000.0207.90
4.4.10.0000.0377.90
4.4.00.0070.0237.90
4.3.110.0000.0277.90
4.3.100.0000.0177.90
4.3.90.0030.0337.90
4.3.80.0000.0477.90
4.3.70.0000.0237.90
4.3.60.0000.0277.90
4.3.50.0070.0207.90
4.3.40.0030.0507.90
4.3.30.0000.0407.90
4.3.20.0070.0307.90
4.3.10.0030.0337.90
4.3.00.0030.0207.90

preferences:
61.51 ms | 401 KiB | 5 Q