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 $xxoo::staticProperty; //如果不借助实例,那就直接用类名加双冒号 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.60.0110.00418.18
8.3.50.0120.01021.21
8.3.40.0130.00618.88
8.3.30.0140.00018.84
8.3.20.0050.00318.91
8.3.10.0040.00420.64
8.3.00.0070.00021.93
8.2.180.0170.00316.88
8.2.170.0150.00022.96
8.2.160.0030.01020.35
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0080.00417.75
8.2.110.0080.00022.13
8.2.100.0040.00717.84
8.2.90.0040.00419.09
8.2.80.0040.00417.97
8.2.70.0040.00417.63
8.2.60.0080.00017.87
8.2.50.0040.00418.07
8.2.40.0030.00618.22
8.2.30.0000.00819.84
8.2.20.0070.00017.60
8.2.10.0000.00717.68
8.2.00.0040.00417.68
8.1.280.0040.01125.92
8.1.270.0000.00723.99
8.1.260.0070.01026.35
8.1.250.0070.00028.09
8.1.240.0090.00322.59
8.1.230.0040.00720.95
8.1.220.0030.00618.77
8.1.210.0060.00318.84
8.1.200.0060.00317.25
8.1.190.0040.00417.66
8.1.180.0000.00718.10
8.1.170.0000.00818.47
8.1.160.0000.00718.94
8.1.150.0050.00318.65
8.1.140.0040.00417.54
8.1.130.0030.00317.88
8.1.120.0000.00717.48
8.1.110.0000.00717.43
8.1.100.0000.00717.32
8.1.90.0040.00417.37
8.1.80.0070.00017.37
8.1.70.0080.00017.43
8.1.60.0000.00717.61
8.1.50.0060.00317.36
8.1.40.0000.00817.56
8.1.30.0080.00017.64
8.1.20.0000.00817.60
8.1.10.0040.00417.49
8.1.00.0040.00417.50
8.0.300.0040.00419.90
8.0.290.0060.00316.75
8.0.280.0000.00818.44
8.0.270.0000.00717.21
8.0.260.0000.00716.89
8.0.250.0070.00016.96
8.0.240.0030.00617.05
8.0.230.0000.00716.92
8.0.220.0070.00017.03
8.0.210.0000.00716.80
8.0.200.0040.00416.95
8.0.190.0040.00416.96
8.0.180.0000.00716.82
8.0.170.0070.00017.07
8.0.160.0000.00716.90
8.0.150.0000.00816.95
8.0.140.0000.00816.82
8.0.130.0040.00413.48
8.0.120.0000.00816.84
8.0.110.0020.00517.00
8.0.100.0000.00816.90
8.0.90.0050.00316.85
8.0.80.0090.01216.84
8.0.70.0000.00816.98
8.0.60.0000.00816.96
8.0.50.0080.00016.78
8.0.30.0070.01217.22
8.0.20.0150.00317.40
8.0.10.0000.00716.88
8.0.00.0140.00616.82
7.4.330.0020.00214.83
7.4.320.0030.00316.52
7.4.300.0030.00316.61
7.4.290.0070.00016.52
7.4.280.0040.00416.63
7.4.270.0000.00716.62
7.4.260.0030.00313.29
7.4.250.0020.00516.46
7.4.240.0000.00716.51
7.4.230.0000.00716.70
7.4.220.0140.00416.61
7.4.210.0090.00716.51
7.4.200.0040.00416.56
7.4.190.0000.00716.75
7.4.160.0130.00916.63
7.4.150.0060.01817.40
7.4.140.0100.01417.86
7.4.130.0120.00616.59
7.4.120.0070.01116.60
7.4.110.0060.01116.43
7.4.100.0080.00816.51
7.4.90.0100.00916.54
7.4.80.0030.01419.37
7.4.70.0080.00816.41
7.4.60.0090.01316.39
7.4.50.0000.00416.54
7.4.40.0090.00022.27
7.4.30.0040.01816.57
7.4.00.0030.00914.61
7.3.330.0050.00013.51
7.3.320.0060.00013.20
7.3.310.0030.00316.26
7.3.300.0030.00316.42
7.3.290.0030.01016.40
7.3.280.0090.00716.48
7.3.270.0140.00317.40
7.3.260.0140.00818.24
7.3.250.0140.00916.48
7.3.240.0040.01416.45
7.3.230.0120.00416.48
7.3.210.0130.00316.45
7.3.200.0080.00819.39
7.3.190.0090.01216.46
7.3.180.0070.01016.71
7.3.170.0040.01516.40
7.3.160.0090.01116.51
7.3.120.0040.01414.95
7.2.330.0110.00716.78
7.2.320.0100.00716.83
7.2.310.0090.01316.84
7.2.300.0140.00316.64
7.2.290.0100.00716.72
7.2.60.0030.01016.81
7.2.00.0040.01119.38
7.1.200.0070.00415.38
7.1.100.0030.01017.87
7.1.70.0040.00416.98
7.1.60.0120.01219.40
7.1.50.0060.00616.94
7.1.00.0030.06022.54
7.0.200.0430.00014.46
7.0.140.0030.07721.95
7.0.60.0100.07320.03
7.0.50.0070.08317.82
7.0.40.0130.07317.72
7.0.30.0070.06317.69
7.0.20.0170.07017.81
7.0.10.0130.03717.75
7.0.00.0100.05017.80
5.6.280.0130.06321.10
5.6.210.0100.03720.57
5.6.200.0070.06318.19
5.6.190.0070.08018.17
5.6.180.0030.07318.28
5.6.170.0070.07018.25
5.6.160.0070.04018.18
5.6.150.0130.08318.12
5.6.140.0070.08018.15
5.6.130.0100.07718.27
5.6.120.0030.08718.28
5.6.110.0100.05718.16
5.6.100.0030.07718.18
5.6.90.0030.08018.13
5.6.80.0100.07317.54
5.6.70.0100.04317.63
5.6.60.0100.07317.59
5.6.50.0100.07717.57
5.6.40.0000.06717.48
5.6.30.0070.07717.59
5.6.20.0070.07717.61
5.6.10.0100.06017.51
5.6.00.0030.04717.50
5.5.350.0270.04020.45
5.5.340.0030.08717.98
5.5.330.0070.05018.04
5.5.320.0100.06718.01
5.5.310.0070.06717.91
5.5.300.0030.05317.98
5.5.290.0030.07017.93
5.5.280.0130.08017.98
5.5.270.0030.05318.06
5.5.260.0070.06317.97
5.5.250.0100.08017.75
5.5.240.0100.07317.43
5.5.230.0230.03317.33
5.5.220.0070.07717.45
5.5.210.0130.07317.39
5.5.200.0030.07017.44
5.5.190.0030.05017.31
5.5.180.0070.08017.43
5.5.160.0100.07717.34
5.5.150.0130.07317.43
5.5.140.0070.07017.43
5.5.130.0200.06317.39
5.5.120.0070.06317.34
5.5.110.0130.05317.28
5.5.100.0100.07017.33
5.5.90.0070.05017.19
5.5.80.0030.08017.29
5.5.70.0030.08017.32
5.5.60.0030.05317.20
5.5.50.0130.07717.28
5.5.40.0100.04717.20
5.5.30.0030.08017.30
5.5.20.0130.07017.32
5.5.10.0100.04317.32
5.5.00.0030.03717.31
5.4.450.0130.07019.48
5.4.440.0130.06719.38
5.4.430.0200.07319.59
5.4.420.0070.08319.27
5.4.410.0070.06019.21
5.4.400.0070.06019.10
5.4.390.0000.05318.88
5.4.380.0030.08319.01
5.4.370.0130.05319.01
5.4.360.0030.05319.07
5.4.350.0100.05018.89
5.4.340.0030.08019.03
5.4.320.0030.08019.10
5.4.310.0070.06719.04
5.4.300.0030.04719.01
5.4.290.0070.07719.31
5.4.280.0130.07318.97
5.4.270.0070.07719.11
5.4.260.0100.07719.12
5.4.250.0070.06019.04
5.4.240.0170.07019.04
5.4.230.0030.08019.26
5.4.220.0130.07319.08
5.4.210.0100.07319.02
5.4.200.0070.07718.94
5.4.190.0030.06719.11
5.4.180.0170.05719.26
5.4.170.0130.03719.02
5.4.160.0030.03719.12
5.4.150.0030.03719.07
5.4.140.0030.03716.43
5.4.130.0070.03316.39
5.4.120.0000.04016.51
5.4.110.0070.04016.47
5.4.100.0000.03716.43
5.4.90.0030.03316.42
5.4.80.0000.03716.33
5.4.70.0000.03716.42
5.4.60.0070.03016.43
5.4.50.0000.03716.40
5.4.40.0070.03016.47
5.4.30.0070.03016.39
5.4.20.0000.03716.45
5.4.10.0030.03316.48
5.4.00.0030.03315.74
5.3.290.0070.08014.70
5.3.280.0070.08014.65
5.3.270.0070.05714.83
5.3.260.0000.04014.61
5.3.250.0030.03714.46
5.3.240.0070.03314.64
5.3.230.0030.03714.62
5.3.220.0030.03314.59
5.3.210.0070.03314.42
5.3.200.0000.03714.80
5.3.190.0000.04014.59
5.3.180.0030.06314.67
5.3.170.0000.05014.62
5.3.160.0070.03714.54
5.3.150.0000.03714.59
5.3.140.0070.04014.57
5.3.130.0000.04014.57
5.3.120.0070.03314.61
5.3.110.0000.04314.53
5.3.100.0070.03314.25
5.3.90.0000.04014.02
5.3.80.0000.03714.04
5.3.70.0030.03314.12
5.3.60.0070.03013.90
5.3.50.0030.03713.98
5.3.40.0070.03313.97
5.3.30.0000.03713.96
5.3.20.0030.03713.75
5.3.10.0000.04013.87
5.3.00.0130.02313.67
5.2.170.0070.02311.14
5.2.160.0000.03011.19
5.2.150.0000.03011.14
5.2.140.0000.03011.19
5.2.130.0030.02711.11
5.2.120.0030.02711.02
5.2.110.0030.02711.00
5.2.100.0000.03011.09
5.2.90.0000.03011.11
5.2.80.0030.03011.16
5.2.70.0100.02711.20
5.2.60.0030.03011.06
5.2.50.0000.03010.98
5.2.40.0030.02711.04
5.2.30.0070.04010.82
5.2.20.0070.05010.95
5.2.10.0130.03710.81
5.2.00.0070.06010.79
5.1.60.0100.0509.92
5.1.50.0000.06010.03
5.1.40.0030.04310.03
5.1.30.0130.03710.38
5.1.20.0000.06010.36
5.1.10.0030.02710.12
5.1.00.0030.05710.00
5.0.50.0070.0378.55
5.0.40.0030.0278.32
5.0.30.0070.0338.21
5.0.20.0100.0408.19
5.0.10.0100.0238.16
5.0.00.0000.0678.10
4.4.90.0030.0137.52
4.4.80.0000.0177.52
4.4.70.0030.0177.52
4.4.60.0030.0177.52
4.4.50.0100.0177.52
4.4.40.0000.0577.52
4.4.30.0000.0377.52
4.4.20.0000.0207.52
4.4.10.0030.0377.52
4.4.00.0000.0437.52
4.3.110.0030.0177.52
4.3.100.0030.0337.52
4.3.90.0030.0307.52
4.3.80.0030.0507.52
4.3.70.0030.0277.52
4.3.60.0030.0377.52
4.3.50.0000.0377.52
4.3.40.0000.0507.52
4.3.30.0000.0307.52
4.3.20.0030.0277.52
4.3.10.0070.0207.52
4.3.00.0030.0237.52

preferences:
50.49 ms | 401 KiB | 5 Q