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 $this->staticFunc(); //强制指定访问父类(而不是自己)的函数 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.40.0040.01118.68
8.3.30.0070.00719.18
8.3.20.0030.00520.34
8.3.10.0000.00923.68
8.3.00.0090.00019.26
8.2.170.0040.01122.96
8.2.160.0090.00620.35
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0120.00622.30
8.2.110.0000.00822.06
8.2.100.0060.00617.72
8.2.90.0040.00419.09
8.2.80.0000.00817.97
8.2.70.0030.00617.75
8.2.60.0030.00517.93
8.2.50.0040.00418.07
8.2.40.0040.00418.29
8.2.30.0040.00418.17
8.2.20.0040.00417.67
8.2.10.0080.00317.89
8.2.00.0000.01217.69
8.1.270.0040.00421.92
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0040.00423.91
8.1.230.0080.00319.10
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0120.00017.36
8.1.190.0000.00717.40
8.1.180.0080.00018.10
8.1.170.0030.00618.61
8.1.160.0050.00221.96
8.1.150.0040.00418.45
8.1.140.0050.00217.27
8.1.130.0030.00317.75
8.1.120.0030.00817.32
8.1.110.0060.00317.43
8.1.100.0000.00817.36
8.1.90.0040.00417.47
8.1.80.0000.00817.44
8.1.70.0030.00317.33
8.1.60.0050.00317.63
8.1.50.0080.00017.51
8.1.40.0000.00817.43
8.1.30.0040.00417.58
8.1.20.0040.00417.57
8.1.10.0000.00817.45
8.1.00.0040.00417.41
8.0.300.0080.00018.77
8.0.290.0070.00017.28
8.0.280.0000.00718.38
8.0.270.0040.00417.23
8.0.260.0060.00016.88
8.0.250.0000.00716.92
8.0.240.0000.00717.06
8.0.230.0000.00716.88
8.0.220.0070.00016.93
8.0.210.0000.00716.74
8.0.200.0030.00316.84
8.0.190.0030.00316.93
8.0.180.0000.00716.88
8.0.170.0030.00616.81
8.0.160.0030.00316.76
8.0.150.0000.00716.72
8.0.140.0030.00616.76
8.0.130.0070.00013.35
8.0.120.0050.00316.72
8.0.110.0020.00516.89
8.0.100.0030.00516.93
8.0.90.0070.00016.77
8.0.80.0120.01016.93
8.0.70.0040.00416.73
8.0.60.0040.00416.68
8.0.50.0070.00016.72
8.0.30.0110.00816.99
8.0.20.0140.00517.40
8.0.10.0070.00016.89
8.0.00.0100.00716.91
7.4.330.0000.00515.14
7.4.320.0030.00316.46
7.4.300.0030.00316.65
7.4.290.0000.00816.60
7.4.280.0060.00316.56
7.4.270.0000.00816.50
7.4.260.0030.00316.54
7.4.250.0040.00416.53
7.4.240.0050.00216.58
7.4.230.0000.00716.64
7.4.220.0100.01616.63
7.4.210.0070.01016.55
7.4.200.0050.00316.61
7.4.190.0000.00816.48
7.4.160.0120.00316.50
7.4.150.0180.00017.40
7.4.140.0040.01617.86
7.4.130.0110.00716.41
7.4.120.0090.00916.42
7.4.110.0060.01116.46
7.4.100.0070.01416.69
7.4.90.0090.00916.45
7.4.80.0090.01519.39
7.4.70.0080.00816.57
7.4.60.0080.00816.51
7.4.50.0000.00516.63
7.4.40.0140.00022.77
7.4.30.0090.01216.50
7.4.00.0110.00514.93
7.3.330.0000.00513.46
7.3.320.0030.00313.43
7.3.310.0070.00016.41
7.3.300.0000.00716.30
7.3.290.0070.01016.45
7.3.280.0080.01016.43
7.3.270.0170.00717.40
7.3.260.0090.01516.70
7.3.250.0080.00916.52
7.3.240.0160.00016.67
7.3.230.0120.00416.39
7.3.210.0080.00816.57
7.3.200.0200.00319.39
7.3.190.0170.00716.61
7.3.180.0100.00716.39
7.3.170.0030.01316.71
7.3.160.0130.00616.41
7.3.120.0040.01214.87
7.3.110.0100.00714.74
7.3.100.0090.00914.88
7.3.90.0050.01214.77
7.3.80.0070.00814.81
7.3.70.0040.01014.97
7.3.60.0040.01014.74
7.3.50.0110.00214.74
7.3.40.0060.00814.75
7.3.30.0070.00714.95
7.3.20.0090.00616.70
7.3.10.0110.00516.49
7.3.00.0080.00816.58
7.2.330.0060.01216.79
7.2.320.0030.01416.67
7.2.310.0030.01416.81
7.2.300.0030.01316.71
7.2.290.0130.00416.74
7.2.250.0050.01214.89
7.2.240.0030.01515.21
7.2.230.0000.01615.26
7.2.220.0050.01115.34
7.2.210.0070.01015.03
7.2.200.0070.00915.13
7.2.190.0000.01315.04
7.2.180.0020.01014.94
7.2.170.0080.00914.99
7.2.160.0060.01014.93
7.2.150.0070.00516.89
7.2.140.0060.00316.71
7.2.130.0030.01216.65
7.2.120.0130.00316.93
7.2.110.0090.00616.92
7.2.100.0070.01017.10
7.2.90.0130.00017.02
7.2.80.0070.00716.80
7.2.70.0030.00917.10
7.2.60.0050.01016.67
7.2.50.0030.01216.87
7.2.40.0040.01216.87
7.2.30.0080.00616.94
7.2.20.0060.01016.79
7.2.10.0030.01516.98
7.2.00.0050.00918.18
7.1.330.0080.00615.75
7.1.320.0050.00815.68
7.1.310.0070.00915.65
7.1.300.0050.01015.74
7.1.290.0080.00615.80
7.1.280.0100.00315.78
7.1.270.0050.01015.65
7.1.260.0080.00515.77
7.1.250.0030.01315.78
7.1.240.0030.01015.70
7.1.230.0110.00015.63
7.1.220.0000.00815.75
7.1.210.0110.00415.52
7.1.200.0120.00215.73
7.1.190.0060.00315.69
7.1.180.0040.00815.63
7.1.170.0060.01015.81
7.1.160.0110.00715.66
7.1.150.0040.01215.68
7.1.140.0050.00515.83
7.1.130.0000.01715.77
7.1.120.0080.00415.68
7.1.110.0040.01115.59
7.1.100.0030.01016.67
7.1.90.0070.01015.75
7.1.80.0060.00915.70
7.1.70.0050.00516.30
7.1.60.0110.00817.66
7.1.50.0080.01116.20
7.1.40.0040.00715.55
7.1.30.0040.00915.71
7.1.20.0080.00415.63
7.1.10.0060.00615.66
7.1.00.0050.04319.09
7.0.330.0080.00315.38
7.0.320.0000.01215.19
7.0.310.0000.01815.14
7.0.300.0030.01315.27
7.0.290.0030.00615.46
7.0.280.0040.01115.55
7.0.270.0060.00915.36
7.0.260.0000.01215.51
7.0.250.0040.01115.50
7.0.240.0000.01415.20
7.0.230.0120.00415.38
7.0.220.0030.01215.54
7.0.210.0050.00315.54
7.0.200.0020.00816.11
7.0.190.0110.00415.47
7.0.180.0130.00015.38
7.0.170.0060.00615.45
7.0.160.0000.01215.46
7.0.150.0000.01115.43
7.0.140.0020.04318.71
7.0.130.0030.01415.38
7.0.120.0070.00415.44
7.0.110.0110.04317.72
7.0.100.0030.04317.77
7.0.90.0070.03917.75
7.0.80.0090.02217.60
7.0.70.0050.04717.71
7.0.60.0050.04517.59
7.0.50.0020.04617.80
7.0.40.0030.02516.73
7.0.30.0080.04116.53
7.0.20.0080.04016.73
7.0.10.0090.04116.59
7.0.00.0090.03016.53
5.6.400.0040.01114.32
5.6.390.0030.00814.33
5.6.380.0160.00014.52
5.6.370.0000.01414.41
5.6.360.0110.00714.37
5.6.350.0100.00714.61
5.6.340.0040.01114.38
5.6.330.0000.01214.40
5.6.320.0060.00314.33
5.6.310.0060.00614.43
5.6.300.0030.01414.59
5.6.290.0060.00614.20
5.6.280.0080.03917.73
5.6.270.0000.01114.32
5.6.260.0100.02417.49
5.6.250.0080.03517.57
5.6.240.0050.04717.61
5.6.230.0000.03517.49
5.6.220.0060.04017.34
5.6.210.0030.03517.31
5.6.200.0030.04817.45
5.6.190.0070.04417.45
5.6.180.0050.04217.47
5.6.170.0080.03717.58
5.6.160.0050.04617.30
5.6.150.0050.03117.40
5.6.140.0030.03517.42
5.6.130.0090.03217.49
5.6.120.0080.04217.59
5.6.110.0060.04117.62
5.6.100.0080.03317.45
5.6.90.0070.03817.45
5.6.80.0050.04617.18
5.6.70.0070.03717.09
5.6.60.0030.04417.04
5.6.50.0070.03817.25
5.6.40.0070.02517.09
5.6.30.0050.04817.12
5.6.20.0050.02817.04
5.6.10.0050.04217.04
5.6.00.0070.02517.01
5.5.380.0060.03415.78
5.5.370.0030.02315.88
5.5.360.0070.02115.78
5.5.350.0050.04315.60
5.5.340.0070.04516.34
5.5.330.0090.04215.94
5.5.320.0110.03515.91
5.5.310.0030.04715.91
5.5.300.0110.03516.01
5.5.290.0100.03716.07
5.5.280.0070.03816.30
5.5.270.0030.03516.11
5.5.260.0070.04516.03
5.5.250.0080.03115.87
5.5.240.0070.03615.79
5.5.230.0080.04315.63
5.5.220.0070.02715.72
5.5.210.0070.02615.83
5.5.200.0080.02515.69
5.5.190.0070.03515.76
5.5.180.0030.02815.52
5.5.170.0030.00614.07
5.5.160.0070.04015.66
5.5.150.0030.04515.70
5.5.140.0050.02415.73
5.5.130.0030.02915.82
5.5.120.0090.03315.81
5.5.110.0080.03815.92
5.5.100.0120.03515.55
5.5.90.0030.03515.67
5.5.80.0050.02815.85
5.5.70.0090.03315.80
5.5.60.0080.03415.79
5.5.50.0060.02315.66
5.5.40.0050.03215.85
5.5.30.0060.03415.57
5.5.20.0050.03315.65
5.5.10.0070.02115.74
5.5.00.0030.04515.45
5.4.450.0050.02615.15
5.4.440.0100.02315.27
5.4.430.0050.04815.16
5.4.420.0060.03615.21
5.4.410.0020.02715.22
5.4.400.0010.03015.05
5.4.390.0060.02114.98
5.4.380.0030.03715.02
5.4.370.0030.03714.95
5.4.360.0030.02715.13
5.4.350.0020.03515.01
5.4.340.0060.04115.00
5.4.330.0000.01111.10
5.4.320.0070.04114.87
5.4.310.0050.02515.08
5.4.300.0040.02314.89
5.4.290.0050.02414.96
5.4.280.0060.02515.20
5.4.270.0080.04015.05
5.4.260.0020.04614.96
5.4.250.0020.02815.04
5.4.240.0110.01815.08
5.4.230.0020.03814.84
5.4.220.0050.03114.93
5.4.210.0050.03414.87
5.4.200.0070.03814.93
5.4.190.0050.02314.78
5.4.180.0050.03314.98
5.4.170.0050.04014.94
5.4.160.0030.02514.83
5.4.150.0070.02515.21
5.4.140.0070.03713.73
5.4.130.0050.03913.76
5.4.120.0050.04013.57
5.4.110.0050.02613.83
5.4.100.0060.03213.71
5.4.90.0080.03113.83
5.4.80.0070.03413.75
5.4.70.0030.03813.73
5.4.60.0000.03813.71
5.4.50.0090.03813.69
5.4.40.0120.03313.67
5.4.30.0130.03413.85
5.4.20.0040.02813.70
5.4.10.0050.03713.70
5.4.00.0090.03113.40
5.3.290.0050.04212.67
5.3.280.0080.01812.54
5.3.270.0040.03612.71
5.3.260.0050.02212.60
5.3.250.0070.03312.66
5.3.240.0070.04312.56
5.3.230.0030.04312.55
5.3.220.0060.04112.61
5.3.210.0050.03512.53
5.3.200.0080.03712.59
5.3.190.0050.02112.53
5.3.180.0070.01812.69
5.3.170.0070.03412.63
5.3.160.0050.02012.65
5.3.150.0040.03112.69
5.3.140.0050.04212.57
5.3.130.0050.03712.58
5.3.120.0050.04312.66
5.3.110.0020.04712.64
5.3.100.0020.02912.28
5.3.90.0070.03912.33
5.3.80.0080.04012.26
5.3.70.0030.02612.24
5.3.60.0100.01912.31
5.3.50.0060.04012.22
5.3.40.0050.02512.30
5.3.30.0080.04012.20
5.3.20.0050.03412.10
5.3.10.0060.03312.07
5.3.00.0050.03612.04
5.2.170.0100.04712.07
5.2.160.0030.05312.07
5.2.150.0070.06012.07
5.2.140.0030.06012.07
5.2.130.0100.06312.07
5.2.120.0030.03012.07
5.2.110.0030.03312.07
5.2.100.0000.03712.07
5.2.90.0100.03312.07
5.2.80.0100.06312.07
5.2.70.0070.02712.07
5.2.60.0030.03712.07
5.2.50.0070.05712.07
5.2.40.0000.06012.07
5.2.30.0030.04712.07
5.2.20.0070.02712.07
5.2.10.0070.03012.07
5.2.00.0030.03712.07
5.1.60.0070.02312.07
5.1.50.0030.03012.07
5.1.40.0000.02712.07
5.1.30.0030.03312.07
5.1.20.0030.03012.07
5.1.10.0030.02312.07
5.1.00.0030.03712.07
5.0.50.0030.02012.07
5.0.40.0000.02312.07
5.0.30.0070.03012.07
5.0.20.0030.04312.07
5.0.10.0030.02012.07
5.0.00.0000.06712.07
4.4.90.0000.02312.07
4.4.80.0000.03712.07
4.4.70.0030.03012.07
4.4.60.0070.01312.07
4.4.50.0000.03012.07
4.4.40.0030.03312.07
4.4.30.0000.02012.07
4.4.20.0000.01712.07
4.4.10.0030.01312.07
4.4.00.0030.02712.07
4.3.110.0000.01712.07
4.3.100.0000.03312.07
4.3.90.0070.03012.07
4.3.80.0000.05712.07
4.3.70.0000.02712.07
4.3.60.0070.03012.07
4.3.50.0030.03312.07
4.3.40.0070.03312.07
4.3.30.0000.02312.07
4.3.20.0030.02712.07
4.3.10.0070.03012.07
4.3.00.0030.01712.07

preferences:
47.15 ms | 400 KiB | 5 Q