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 $this->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.60.0070.01116.75
8.3.50.0090.00522.04
8.3.40.0110.00418.84
8.3.30.0110.00419.14
8.3.20.0000.00720.34
8.3.10.0030.00623.65
8.3.00.0080.00320.79
8.2.180.0070.00716.63
8.2.170.0070.00722.96
8.2.160.0140.00020.35
8.2.150.0040.00424.18
8.2.140.0070.00024.66
8.2.130.0080.00026.16
8.2.120.0000.00822.28
8.2.110.0100.00022.25
8.2.100.0090.00319.55
8.2.90.0000.00819.21
8.2.80.0000.00817.97
8.2.70.0050.00317.63
8.2.60.0080.00017.80
8.2.50.0050.00318.07
8.2.40.0060.00319.95
8.2.30.0080.00018.20
8.2.20.0000.00717.68
8.2.10.0050.00218.02
8.2.00.0080.00017.69
8.1.280.0090.00625.92
8.1.270.0040.00423.95
8.1.260.0080.00026.35
8.1.250.0090.00028.09
8.1.240.0030.00623.66
8.1.230.0100.00018.99
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0040.00417.10
8.1.180.0040.00419.01
8.1.170.0040.00418.46
8.1.160.0040.00421.97
8.1.150.0000.00718.61
8.1.140.0050.00217.39
8.1.130.0000.00717.81
8.1.120.0080.00017.45
8.1.110.0000.01017.46
8.1.100.0000.00717.31
8.1.90.0040.00417.50
8.1.80.0000.00717.34
8.1.70.0000.00717.41
8.1.60.0030.00617.51
8.1.50.0000.00817.36
8.1.40.0000.00817.60
8.1.30.0040.00417.70
8.1.20.0000.00717.58
8.1.10.0000.00817.63
8.1.00.0000.00717.55
8.0.300.0020.00518.77
8.0.290.0040.00417.16
8.0.280.0000.00718.46
8.0.270.0070.00016.90
8.0.260.0030.00317.18
8.0.250.0030.00316.91
8.0.240.0040.00417.03
8.0.230.0030.00316.93
8.0.220.0070.00016.98
8.0.210.0000.00716.94
8.0.200.0000.00616.99
8.0.190.0040.00416.97
8.0.180.0000.00716.79
8.0.170.0000.00816.84
8.0.160.0040.00416.97
8.0.150.0000.00816.95
8.0.140.0000.00716.77
8.0.130.0060.00013.34
8.0.120.0030.00616.72
8.0.110.0080.00016.91
8.0.100.0050.00316.74
8.0.90.0040.00416.81
8.0.80.0090.00616.96
8.0.70.0070.00016.90
8.0.60.0000.00816.95
8.0.50.0050.00216.79
8.0.30.0090.01317.08
8.0.20.0130.00617.40
8.0.10.0070.00016.84
8.0.00.0070.01016.78
7.4.330.0030.00315.09
7.4.320.0030.00316.37
7.4.300.0030.00316.39
7.4.290.0050.00316.52
7.4.280.0000.00716.41
7.4.270.0040.00316.43
7.4.260.0030.00316.61
7.4.250.0030.00316.59
7.4.240.0060.00116.63
7.4.230.0070.00016.47
7.4.220.0200.00716.56
7.4.210.0080.00916.57
7.4.200.0050.00216.34
7.4.190.0000.00716.75
7.4.160.0130.00316.51
7.4.150.0160.01017.40
7.4.140.0070.01117.86
7.4.130.0080.00816.49
7.4.120.0080.01116.64
7.4.110.0070.01016.66
7.4.100.0080.00916.57
7.4.90.0090.00916.55
7.4.80.0060.01319.39
7.4.70.0080.00816.77
7.4.60.0110.00616.57
7.4.50.0080.00016.52
7.4.40.0030.01416.68
7.4.30.0120.00916.41
7.4.00.0100.00614.82
7.3.330.0060.00013.36
7.3.320.0030.00313.36
7.3.310.0030.00516.39
7.3.300.0000.00716.18
7.3.290.0070.00716.37
7.3.280.0070.01116.37
7.3.270.0140.00317.40
7.3.260.0130.00316.29
7.3.250.0090.00816.57
7.3.240.0110.00616.41
7.3.230.0070.01016.39
7.3.210.0090.00916.52
7.3.200.0100.00719.39
7.3.190.0190.00316.42
7.3.180.0060.01516.29
7.3.170.0090.00916.49
7.3.160.0070.01516.41
7.3.120.0030.01414.70
7.3.110.0070.01014.82
7.3.100.0100.00615.04
7.3.90.0030.00914.81
7.3.80.0130.00014.51
7.3.70.0120.00614.74
7.3.60.0000.01414.71
7.3.50.0040.01114.99
7.3.40.0030.01014.92
7.3.30.0090.00614.96
7.3.20.0070.00716.72
7.3.10.0100.00116.42
7.3.00.0050.00716.61
7.2.330.0000.01816.78
7.2.320.0030.01416.27
7.2.310.0150.00316.87
7.2.300.0140.01116.77
7.2.290.0160.00016.70
7.2.250.0060.00914.63
7.2.240.0120.00914.66
7.2.230.0120.00315.20
7.2.220.0130.00614.59
7.2.210.0030.01014.93
7.2.200.0130.00615.04
7.2.190.0000.01615.13
7.2.180.0100.00315.08
7.2.170.0120.00015.07
7.2.130.0000.01116.91
7.2.120.0040.01116.92
7.2.110.0050.00516.86
7.2.100.0040.00716.55
7.2.90.0000.01316.67
7.2.80.0080.00317.11
7.2.70.0080.00316.85
7.2.60.0020.01116.89
7.2.50.0030.00817.01
7.2.40.0060.00617.06
7.2.30.0000.01416.84
7.2.20.0030.00716.65
7.2.10.0030.00816.68
7.2.00.0050.00818.17
7.1.330.0030.01015.89
7.1.320.0060.00615.67
7.1.310.0070.00715.78
7.1.300.0040.00815.72
7.1.290.0060.00315.64
7.1.280.0070.00715.71
7.1.270.0060.00915.70
7.1.260.0030.00615.73
7.1.250.0060.00315.64
7.1.200.0000.00715.65
7.1.100.0040.00818.32
7.1.70.0000.00816.73
7.1.60.0090.01519.46
7.1.50.0130.01016.75
7.1.00.0000.08022.35
7.0.200.0000.00816.67
7.0.140.0000.07722.07
7.0.60.0030.08021.76
7.0.50.0100.07322.02
7.0.40.0000.08020.11
7.0.30.0070.08020.04
7.0.20.0000.08320.03
7.0.10.0070.07320.02
7.0.00.0070.07020.02
5.6.280.0100.06721.14
5.6.210.0030.06320.52
5.6.200.0070.08321.06
5.6.190.0030.08721.14
5.6.180.0000.09021.13
5.6.170.0000.08021.03
5.6.160.0030.07721.01
5.6.150.0100.07721.13
5.6.140.0100.08021.04
5.6.130.0100.05721.16
5.6.120.0100.08320.99
5.6.110.0130.06720.97
5.6.100.0130.07320.95
5.6.90.0100.07721.11
5.6.80.0000.08020.43
5.6.70.0070.06320.51
5.6.60.0030.07720.50
5.6.50.0000.08320.39
5.6.40.0130.07020.34
5.6.30.0070.05020.31
5.6.20.0070.07320.51
5.6.10.0070.06320.48
5.6.00.0070.06320.50
5.5.350.0100.08020.50
5.5.340.0000.08320.79
5.5.330.0070.07020.68
5.5.320.0100.07320.82
5.5.310.0070.08020.79
5.5.300.0100.08020.98
5.5.290.0070.06720.67
5.5.280.0070.08320.78
5.5.270.0030.07320.96
5.5.260.0070.08020.89
5.5.250.0100.07720.59
5.5.240.0000.08320.29
5.5.230.0100.07020.22
5.5.220.0070.07720.28
5.5.210.0100.07020.08
5.5.200.0100.06020.26
5.5.190.0100.06020.34
5.5.180.0070.07320.14
5.5.160.0100.06020.16
5.5.150.0070.06320.32
5.5.140.0130.05720.15
5.5.130.0000.07720.16
5.5.120.0030.08320.02
5.5.110.0000.08020.16
5.5.100.0070.07719.91
5.5.90.0000.07320.13
5.5.80.0070.07320.02
5.5.70.0030.06720.07
5.5.60.0000.07320.01
5.5.50.0030.07719.96
5.5.40.0100.07720.20
5.5.30.0070.06020.06
5.5.20.0070.05720.09
5.5.10.0000.08320.01
5.5.00.0170.06320.09
5.4.450.0000.08319.39
5.4.440.0030.05319.40
5.4.430.0070.07019.39
5.4.420.0030.08019.52
5.4.410.0100.07019.21
5.4.400.0030.08018.95
5.4.390.0000.07719.20
5.4.380.0070.06719.16
5.4.370.0170.06719.20
5.4.360.0070.07319.16
5.4.350.0070.07019.02
5.4.340.0030.07719.02
5.4.320.0000.07318.90
5.4.310.0070.06019.20
5.4.300.0100.07019.21
5.4.290.0000.07719.07
5.4.280.0030.07719.04
5.4.270.0030.06019.20
5.4.260.0030.07719.17
5.4.250.0070.07319.16
5.4.240.0100.07019.06
5.4.230.0030.08319.06
5.4.220.0070.07719.20
5.4.210.0030.06018.91
5.4.200.0100.07318.92
5.4.190.0070.05718.89
5.4.180.0000.06319.04
5.4.170.0100.07319.00
5.4.160.0070.07019.03
5.4.150.0030.07718.86
5.4.140.0030.06316.30
5.4.130.0070.06716.50
5.4.120.0000.07016.38
5.4.110.0100.04316.43
5.4.100.0000.04316.30
5.4.90.0030.05716.50
5.4.80.0070.06716.44
5.4.70.0100.07016.50
5.4.60.0000.07716.52
5.4.50.0030.07016.32
5.4.40.0000.07716.40
5.4.30.0070.06716.28
5.4.20.0030.07316.31
5.4.10.0070.07016.34
5.4.00.0070.06715.88
5.3.290.0030.07314.64
5.3.280.0030.07714.70
5.3.270.0130.07014.63
5.3.260.0000.08014.70
5.3.250.0030.07714.69
5.3.240.0030.06714.66
5.3.230.0100.06314.60
5.3.220.0070.06714.49
5.3.210.0100.07314.57
5.3.200.0100.03014.58
5.3.190.0100.06314.67
5.3.180.0070.06014.48
5.3.170.0030.07014.67
5.3.160.0000.07714.64
5.3.150.0000.08314.54
5.3.140.0030.08014.68
5.3.130.0030.07314.65
5.3.120.0070.05714.47
5.3.110.0000.07014.63
5.3.100.0070.06714.13
5.3.90.0030.07314.13
5.3.80.0030.07314.12
5.3.70.0000.07314.11
5.3.60.0000.07714.10
5.3.50.0000.06713.97
5.3.40.0000.06713.86
5.3.30.0000.03713.78
5.3.20.0000.03313.56
5.3.10.0000.03313.71
5.3.00.0000.03713.69
5.2.170.0000.06312.57
5.2.160.0070.05712.57
5.2.150.0000.03312.57
5.2.140.0030.02712.57
5.2.130.0030.02712.57
5.2.120.0030.02712.57
5.2.110.0000.03012.57
5.2.100.0070.02312.57
5.2.90.0030.02712.57
5.2.80.0000.03012.57
5.2.70.0000.03012.57
5.2.60.0000.03312.57
5.2.50.0000.02312.57
5.2.40.0000.03312.57
5.2.30.0000.03012.57
5.2.20.0000.06012.57
5.2.10.0000.02712.57
5.2.00.0070.02712.57
5.1.60.0030.04012.57
5.1.50.0000.03012.57
5.1.40.0000.03312.57
5.1.30.0000.03012.57
5.1.20.0030.07012.57
5.1.10.0030.06312.57
5.1.00.0000.03312.57
5.0.50.0000.01712.57
5.0.40.0000.02712.57
5.0.30.0000.02712.57
5.0.20.0030.01712.57
5.0.10.0030.01712.57
5.0.00.0030.03012.57
4.4.90.0000.01312.57
4.4.80.0030.01012.57
4.4.70.0000.03012.57
4.4.60.0000.01712.57
4.4.50.0030.01712.57
4.4.40.0000.02012.57
4.4.30.0000.01712.57
4.4.20.0000.01712.57
4.4.10.0030.01312.57
4.4.00.0000.04012.57
4.3.110.0000.01712.57
4.3.100.0000.01712.57
4.3.90.0030.01312.57
4.3.80.0000.02312.57
4.3.70.0000.01312.57
4.3.60.0030.01012.57
4.3.50.0000.01312.57
4.3.40.0000.03012.57
4.3.30.0000.01712.57
4.3.20.0070.01012.57
4.3.10.0000.01712.57
4.3.00.0000.01712.57

preferences:
41 ms | 401 KiB | 5 Q