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('B'.$i, 'A'); } echo 'buildDynamicClass: '.(microtime(TRUE)-$start); $start = microtime(TRUE); for($i=0;$i<10000;$i++) { buildDynamicClass2('C'.$i, 'A'); } 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.2.00.0030.03826.38
7.1.70.0040.03227.07
7.1.60.0170.06222.59
7.1.50.0030.05822.00
7.1.00.0100.13332.15
7.0.200.0540.03724.14
7.0.140.0100.13031.88
7.0.70.0100.14331.57
7.0.60.0130.14031.55
7.0.50.0130.12031.95
7.0.40.0230.11024.05
7.0.30.0200.13024.03
7.0.20.0100.13723.98
7.0.10.0100.13024.04
7.0.00.0070.13723.98
5.6.280.0030.16330.42
5.6.220.0230.14029.80
5.6.210.0070.16330.02
5.6.200.0100.16330.30
5.6.190.0200.15330.33
5.6.180.0130.14030.34
5.6.170.0100.15730.21
5.6.160.0070.16730.41
5.6.150.0100.16730.39
5.6.140.0100.15330.32
5.6.130.0130.12730.46
5.6.120.0030.13730.36
5.6.110.0030.13030.32
5.6.100.0200.12730.42
5.6.90.0130.14330.25
5.6.80.0100.11329.63
5.6.70.0170.13329.80
5.6.60.0230.13029.84
5.6.50.0270.19029.80
5.6.40.0100.14329.70
5.6.30.0070.16029.77
5.6.20.0100.15729.75
5.6.10.0130.13729.76
5.6.00.0170.16029.70
5.5.360.0200.15729.40
5.5.350.0170.15029.38
5.5.340.0100.11329.90
5.5.330.0370.15729.88
5.5.320.0030.15329.91
5.5.310.0070.15029.82
5.5.300.0170.13729.92
5.5.290.0070.16329.98
5.5.280.0100.12029.89
5.5.270.0130.15029.99
5.5.260.0030.16029.86
5.5.250.0130.14729.68
5.5.240.0100.15329.26
5.5.230.0130.14329.36
5.5.220.0530.15029.27
5.5.210.0100.10729.35
5.5.200.0500.12029.24
5.5.190.0100.13729.33
5.5.180.0270.14329.33
5.5.160.0330.14329.31
5.5.150.0070.13329.34
5.5.140.0030.17729.27
5.5.130.0070.13729.20
5.5.120.0030.08729.31
5.5.110.0070.10328.98
5.5.100.0100.07729.04
5.5.90.0070.07329.17
5.5.80.0070.06729.20
5.5.70.0030.06728.95
5.5.60.0030.06729.19
5.5.50.0070.08729.07
5.5.40.0170.13729.12
5.5.30.0230.15728.99
5.5.20.0070.14728.96
5.5.10.0070.14029.12
5.5.00.0130.15329.12
5.4.450.0100.12028.46
5.4.440.0070.13028.46
5.4.430.0030.11728.45
5.4.420.0000.10728.41
5.4.410.0100.12328.33
5.4.400.0030.13328.25
5.4.390.0100.13728.15
5.4.380.0100.13028.25
5.4.370.0130.07328.22
5.4.360.0130.09328.09
5.4.350.0130.12028.04
5.4.340.0100.12328.15
5.4.320.0300.11728.06
5.4.310.0230.11028.06
5.4.300.0170.10728.14
5.4.290.0170.09027.89
5.4.280.0130.09727.99
5.4.270.0030.09327.94
5.4.260.0100.07327.98
5.4.250.0070.08328.00
5.4.240.0170.05028.02
5.4.230.0030.06327.83
5.4.220.0030.07028.05
5.4.210.0030.09728.05
5.4.200.0100.13027.89
5.4.190.0100.12028.18
5.4.180.0230.12728.02
5.4.170.0200.10028.01
5.4.160.0270.15027.81
5.4.150.0130.13327.96
5.4.140.0070.12725.23
5.4.130.0070.12725.22
5.4.120.0030.10725.50
5.4.110.0200.10725.39
5.4.100.0070.09025.50
5.4.90.0130.12325.46
5.4.80.0070.13725.27
5.4.70.0170.12325.35
5.4.60.0030.13025.41
5.4.50.0100.12725.46
5.4.40.0230.11325.48
5.4.30.0100.13325.30
5.4.20.0070.13725.50
5.4.10.0070.11325.33
5.4.00.0070.12024.86

preferences:
37.25 ms | 400 KiB | 5 Q