3v4l.org

run code in 300+ PHP versions simultaneously
<?php function buildDynamicClass($parent, $child) { $reflection = new ReflectionClass($child); if($reflection->isAbstract()) { $abstract = 'abstract'; } else { $abstract = ''; } eval($abstract.' class '.$parent.' extends '.$child.' { }'); } function buildDynamicClass2($parent, $child) { class_alias($child, $parent); } class A { } $start = microtime(TRUE); for($i=0;$i<10000;$i++) { buildDynamicClass('A', 'B'.$i); } echo 'buildDynamicClass: '.(microtime(TRUE)-$start); $start = microtime(TRUE); for($i=0;$i<10000;$i++) { buildDynamicClass2('A', 'B'.$i); } echo 'buildDynamicClass2: '.(microtime(TRUE)-$start);

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)
7.4.10.0110.00615.23
7.4.00.0120.00715.02
7.3.130.0070.01114.66
7.3.120.0070.01114.87
7.3.110.0060.01314.93
7.3.100.0070.00814.75
7.3.90.0070.00814.83
7.3.80.0070.00614.90
7.3.70.0080.00814.99
7.3.60.0020.01114.96
7.3.50.0060.00714.78
7.3.40.0070.00514.76
7.3.30.0030.01014.67
7.3.20.0070.00616.58
7.3.10.0050.00916.60
7.3.00.0090.00616.74
7.2.260.0050.01314.98
7.2.250.0090.00915.14
7.2.240.0060.00815.07
7.2.230.0060.00814.92
7.2.220.0100.00514.96
7.2.210.0030.00915.06
7.2.200.0030.01114.97
7.2.190.0050.00815.13
7.2.180.0090.00415.11
7.2.170.0080.00915.14
7.2.160.0080.01015.14
7.2.150.0080.00716.88
7.2.140.0050.00916.96
7.2.130.0060.01016.97
7.2.120.0050.00517.02
7.2.110.0030.00916.83
7.2.100.0040.00916.89
7.2.90.0130.00216.84
7.2.80.0060.01116.96
7.2.70.0020.01616.88
7.2.60.0070.00816.84
7.2.50.0050.00816.94
7.2.40.0070.00616.88
7.2.30.0050.00916.95
7.2.20.0050.01016.93
7.2.10.0060.00816.88
7.2.00.0050.00717.56
7.1.330.0110.00315.84
7.1.320.0050.00815.79
7.1.310.0020.01015.93
7.1.300.0030.00915.70
7.1.290.0100.00015.79
7.1.280.0050.00715.59
7.1.270.0040.01215.75
7.1.260.0050.00615.69
7.1.250.0070.00715.78
7.1.240.0100.00315.89
7.1.230.0050.00815.76
7.1.220.0070.00715.75
7.1.210.0050.00815.79
7.1.200.0080.01115.86
7.1.190.0060.00515.68
7.1.180.0050.00915.59
7.1.170.0070.00515.82
7.1.160.0030.01015.74
7.1.150.0080.00515.90
7.1.140.0030.00715.87
7.1.130.0000.01215.80
7.1.120.0060.00515.90
7.1.110.0040.00815.87
7.1.100.0000.01115.84
7.1.90.0050.00715.99
7.1.80.0030.01015.84
7.1.70.0020.00916.32
7.1.60.0070.00916.89
7.1.50.0090.00816.09
7.1.40.0070.00515.71
7.1.30.0050.00915.86
7.1.20.0060.00715.82
7.1.10.0010.00815.84
7.1.00.0010.03918.03
7.0.330.0040.00715.37
7.0.320.0060.00615.42
7.0.310.0050.01115.39
7.0.300.0050.00915.48
7.0.290.0070.00515.35
7.0.280.0060.00715.26
7.0.270.0060.00515.50
7.0.260.0030.00815.47
7.0.250.0090.00415.49
7.0.240.0020.01015.64
7.0.230.0050.00815.41
7.0.220.0030.00715.30
7.0.210.0020.00915.29
7.0.200.0030.00715.77
7.0.190.0030.00915.53
7.0.180.0110.00215.42
7.0.170.0050.00615.34
7.0.160.0020.00715.51
7.0.150.0020.00815.26
7.0.140.0040.02817.62
7.0.130.0020.01115.56
7.0.120.0070.00715.33
7.0.110.0080.00515.53
7.0.100.0040.00715.34
7.0.90.0080.00315.45
7.0.80.0050.00815.37
7.0.70.0000.01115.49
7.0.60.0070.01717.03
7.0.50.0050.02916.24
7.0.40.0090.02415.87
7.0.30.0110.02015.65
7.0.20.0110.02515.69
7.0.10.0050.03715.67
7.0.00.0050.02315.75
5.6.400.0040.01014.42
5.6.390.0050.01114.38
5.6.380.0050.00814.27
5.6.370.0070.00914.36
5.6.360.0050.00914.08
5.6.350.0030.00914.30
5.6.340.0050.00714.18
5.6.330.0020.01314.48
5.6.320.0050.00914.62
5.6.310.0040.00714.33
5.6.300.0050.00414.20
5.6.290.0040.00914.26
5.6.280.0020.03016.46
5.6.270.0020.01014.33
5.6.260.0060.00814.21
5.6.250.0090.00514.29
5.6.240.0050.00814.38
5.6.230.0060.00714.51
5.6.220.0050.01114.33
5.6.210.0100.03016.35
5.6.200.0060.02915.64
5.6.190.0040.02116.44
5.6.180.0100.02016.42
5.6.170.0110.03016.38
5.6.160.0080.02716.52
5.6.150.0050.02015.57
5.6.140.0040.02015.86
5.6.130.0070.02015.79
5.6.120.0020.02616.58
5.6.110.0080.03316.53
5.6.100.0130.02916.65
5.6.90.0060.03116.62
5.6.80.0040.02216.39
5.6.70.0000.01014.07
5.6.60.0060.00314.25
5.6.50.0030.00714.17
5.6.40.0080.00514.32
5.6.30.0050.00714.18
5.6.20.0090.00414.30
5.6.10.0110.00014.22
5.6.00.0040.00714.32
5.5.380.0080.00614.11
5.5.370.0070.00514.25
5.5.360.0070.00714.22
5.5.350.0040.03316.38
5.5.340.0040.02715.41
5.5.330.0070.01916.30
5.5.320.0170.02016.32
5.5.310.0160.01616.11
5.5.300.0060.02415.47
5.5.290.0050.03315.51
5.5.280.0090.02416.41
5.5.270.0040.02916.47
5.5.260.0010.03516.32
5.5.250.0050.01916.28
5.5.240.1280.02016.16
5.5.230.0080.00314.06
5.5.220.0030.01114.13
5.5.210.0060.00714.20
5.5.200.0030.01013.82
5.5.190.0050.00814.26
5.5.180.0040.00714.09
5.5.170.0030.00814.10
5.5.160.0090.00314.21
5.5.150.0040.00714.20
5.5.140.0070.00713.91
5.5.130.0030.01214.08
5.5.120.0090.00714.33
5.5.110.0100.00614.04
5.5.100.0020.01114.21
5.5.90.0050.00914.19
5.5.80.0100.00513.97
5.5.70.0090.00414.25
5.5.60.0120.00313.98
5.5.50.0030.00914.20
5.5.40.0040.01214.21
5.5.30.0040.00914.20
5.5.20.0070.00614.31
5.5.10.0060.00814.20
5.5.00.0010.00814.06
5.4.450.0120.02114.22
5.4.440.0140.02114.38
5.4.430.0110.02114.25
5.4.420.0220.01814.37
5.4.410.0090.02014.24
5.4.400.0180.01614.11
5.4.390.0170.01914.14
5.4.380.0320.01813.92
5.4.370.0260.01914.00
5.4.360.0260.02514.07
5.4.350.0270.02214.04
5.4.340.0150.02213.96
5.4.330.0050.00411.58
5.4.320.0030.01811.96
5.4.310.0040.01512.00
5.4.300.0040.01811.88
5.4.290.0080.01511.88
5.4.280.0060.01611.84
5.4.270.0030.01811.89
5.4.260.0050.01611.84
5.4.250.0040.01811.87
5.4.240.0060.01611.98
5.4.230.0050.01711.91
5.4.220.0040.01811.97
5.4.210.0050.01511.89
5.4.200.0050.01611.84
5.4.190.0070.01511.94
5.4.180.0030.01911.84
5.4.170.0060.01511.84
5.4.160.0060.01411.95
5.4.150.0070.01511.88
5.4.140.0040.01711.84
5.4.130.0060.01811.85
5.4.120.0050.01711.80
5.4.110.0060.01711.72
5.4.100.0070.01811.73
5.4.90.0040.01911.78
5.4.80.0030.01811.71
5.4.70.0030.01611.85
5.4.60.0020.01811.87
5.4.50.0040.01611.80
5.4.40.0060.01511.80
5.4.30.0040.01511.80
5.4.20.0050.01311.77
5.4.10.0050.01911.71
5.4.00.0030.01811.58
5.3.290.0070.03712.80
5.3.280.0070.03612.71
5.3.270.0070.03712.72
5.3.260.0070.03712.72
5.3.250.0060.03712.71
5.3.240.0060.03612.72
5.3.230.0060.03812.71
5.3.220.0080.04312.68
5.3.210.0060.03912.68
5.3.200.0030.03812.68
5.3.190.0060.03612.68
5.3.180.0070.03512.67
5.3.170.0050.03712.67
5.3.160.0040.03812.68
5.3.150.0070.03512.67
5.3.140.0070.03512.66
5.3.130.0040.04012.66
5.3.120.0090.03512.66
5.3.110.0080.03612.66
5.3.100.0040.03812.13
5.3.90.0050.03612.11
5.3.80.0060.03612.10
5.3.70.0090.03212.10
5.3.60.0090.03212.09
5.3.50.0060.03412.04
5.3.40.0040.03712.04
5.3.30.0060.03412.00
5.3.20.0040.03711.78
5.3.10.0040.03811.74
5.3.00.0050.05111.73
5.2.170.0060.0299.23
5.2.160.0030.0329.23
5.2.150.0030.0319.23
5.2.140.0070.0289.22
5.2.130.0020.0349.19
5.2.120.0040.0429.19
5.2.110.0050.0389.20
5.2.100.0040.0409.19
5.2.90.0030.0369.19
5.2.80.0040.0329.19
5.2.70.0030.0319.19
5.2.60.0050.0299.14
5.2.50.0000.0349.11
5.2.40.0060.0269.09
5.2.30.0030.0309.06
5.2.20.0040.0309.05
5.2.10.0030.0298.96
5.2.00.0060.0278.82
5.1.60.0040.0238.11
5.1.50.0040.0248.10
5.1.40.0040.0248.09
5.1.30.0030.0268.43
5.1.20.0030.0278.46
5.1.10.0030.0268.18
5.1.00.0050.0248.19
5.0.50.0040.0206.66
5.0.40.0020.0206.52
5.0.30.0040.0306.34
5.0.20.0030.0206.30
5.0.10.0040.0186.28
5.0.00.0010.0326.27
4.4.90.0030.0154.78
4.4.80.0030.0224.75
4.4.70.0040.0144.75
4.4.60.0020.0154.76
4.4.50.0030.0144.77
4.4.40.0030.0244.71
4.4.30.0020.0154.76
4.4.20.0010.0164.85
4.4.10.0030.0144.85
4.4.00.0030.0244.76
4.3.110.0030.0154.66
4.3.100.0040.0154.66
4.3.90.0050.0124.63
4.3.80.0020.0244.58
4.3.70.0020.0154.63
4.3.60.0020.0154.63
4.3.50.0050.0144.63
4.3.40.0020.0244.54
4.3.30.0020.0163.33
4.3.20.0030.0153.31
4.3.10.0020.0163.27
4.3.00.0170.01713.40

preferences:
30.57 ms | 401 KiB | 5 Q