3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NumberWrapper { private $number; public function __construct($number) { $this->number = $number; } } class CollectionGenerator { public function create($array, $class) { if(!class_exists($class)) throw new Exception('Kur'); $collection = []; foreach($array as $item) { $collection[] = new $class($item); } } } $someArray = [1, 2, 3, 4]; $wrappedArray = CollectionGenerator::create($someArray, 'NumberWrapper'); var_dump($wrappedArray);

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.0040.01118.43
8.3.50.0230.01022.11
8.3.40.0070.01018.93
8.3.30.0160.00319.18
8.3.20.0080.00020.38
8.3.10.0040.00420.46
8.3.00.0080.00019.38
8.2.180.0090.00616.75
8.2.170.0000.01522.96
8.2.160.0070.00720.43
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0050.00226.16
8.2.120.0030.00722.06
8.2.110.0040.00420.50
8.2.100.0030.00917.69
8.2.90.0090.00019.23
8.2.80.0050.00317.97
8.2.70.0050.00317.38
8.2.60.0030.00617.93
8.2.50.0090.00018.07
8.2.40.0000.00818.03
8.2.30.0040.00418.00
8.2.20.0000.00817.74
8.2.10.0000.00718.14
8.2.00.0040.00417.62
8.1.280.0190.00025.92
8.1.270.0040.00423.75
8.1.260.0080.00026.35
8.1.250.0030.00528.09
8.1.240.0030.00623.96
8.1.230.0110.00018.95
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0040.00717.35
8.1.190.0000.00817.22
8.1.180.0040.00418.10
8.1.170.0030.00518.52
8.1.160.0040.00421.85
8.1.150.0000.00718.90
8.1.140.0080.00017.39
8.1.130.0030.00317.91
8.1.120.0040.00417.31
8.1.110.0000.00817.39
8.1.100.0070.00017.41
8.1.90.0000.00717.29
8.1.80.0040.00417.45
8.1.70.0030.00317.32
8.1.60.0060.00317.59
8.1.50.0030.00617.52
8.1.40.0060.00317.40
8.1.30.0000.00817.51
8.1.20.0040.00417.48
8.1.10.0040.00417.47
8.1.00.0040.00417.56
8.0.300.0000.00818.77
8.0.290.0040.00416.75
8.0.280.0000.00718.38
8.0.270.0070.00017.12
8.0.260.0000.00717.11
8.0.250.0030.00316.97
8.0.240.0000.00816.95
8.0.230.0040.00416.92
8.0.220.0070.00016.91
8.0.210.0000.00716.80
8.0.200.0000.00716.87
8.0.190.0000.00816.95
8.0.180.0040.00416.91
8.0.170.0060.00316.89
8.0.160.0000.00716.90
8.0.150.0050.00216.84
8.0.140.0030.00616.73
8.0.130.0050.00013.39
8.0.120.0030.00516.78
8.0.110.0080.00016.87
8.0.100.0000.00716.85
8.0.90.0050.00216.77
8.0.80.0060.01016.87
8.0.70.0070.00016.77
8.0.60.0040.00416.79
8.0.50.0080.00016.83
8.0.30.0150.00517.01
8.0.20.0130.00517.40
8.0.10.0030.00417.02
8.0.00.0070.01116.71
7.4.330.0030.00315.04
7.4.320.0060.00016.61
7.4.300.0060.00016.61
7.4.290.0030.00316.66
7.4.280.0070.00016.39
7.4.270.0030.00316.62
7.4.260.0040.00416.51
7.4.250.0030.00316.48
7.4.240.0030.00316.53
7.4.230.0030.00316.35
7.4.220.0100.01216.62
7.4.210.0060.00916.47
7.4.200.0000.00716.39
7.4.160.0100.00616.29
7.4.150.0070.01117.40
7.4.140.0080.00917.86
7.4.130.0100.00716.54
7.4.120.0130.00816.59
7.4.110.0060.01316.64
7.4.100.0140.00316.44
7.4.90.0070.01016.75
7.4.80.0140.00419.39
7.4.70.0090.00916.75
7.4.60.0090.00916.32
7.4.50.0080.00016.75
7.4.40.0100.00616.53
7.4.30.0070.01016.48
7.4.00.0080.00714.94
7.3.330.0050.00013.36
7.3.320.0030.00313.26
7.3.310.0030.00316.46
7.3.300.0000.00616.43
7.3.290.0110.00416.39
7.3.280.0060.01016.44
7.3.270.0120.00617.40
7.3.260.0090.00916.70
7.3.250.0140.00816.48
7.3.240.0130.00816.61
7.3.230.0120.00916.57
7.3.210.0100.00716.42
7.3.200.0030.02019.39
7.3.190.0070.01016.62
7.3.180.0090.00616.39
7.3.170.0130.00316.54
7.3.160.0060.01316.53
7.3.120.0070.01114.89
7.3.110.0070.01014.96
7.3.100.0030.00714.99
7.3.90.0040.00815.09
7.3.80.0030.01014.85
7.3.70.0060.00614.83
7.3.60.0060.00614.71
7.3.50.0090.00314.86
7.3.40.0080.00414.80
7.3.30.0060.00614.90
7.3.20.0110.00416.72
7.3.10.0110.00016.66
7.3.00.0040.01216.87
7.2.330.0100.00716.71
7.2.320.0030.01316.82
7.2.310.0110.00716.88
7.2.300.0070.01016.71
7.2.290.0130.00316.70
7.2.250.0070.01114.87
7.2.240.0100.01015.22
7.2.230.0030.01215.22
7.2.220.0000.01415.06
7.2.210.0040.01215.27
7.2.200.0100.00015.23
7.2.190.0040.00915.04
7.2.180.0070.01014.95
7.2.170.0040.01115.07
7.2.60.0030.01216.86
7.2.00.0060.00619.43
7.1.330.0090.00616.04
7.1.320.0100.00315.91
7.1.310.0080.00815.96
7.1.300.0070.00715.95
7.1.290.0030.01015.77
7.1.280.0080.00415.82
7.1.270.0080.00516.02
7.1.260.0100.00615.84
7.1.200.0030.01215.95
7.1.100.0000.01117.77
7.1.70.0030.00617.07
7.1.60.0030.02219.32
7.1.50.0070.01816.86
7.1.00.0030.07722.37
7.0.200.0040.00416.78
7.0.140.0030.07022.09
7.0.60.0100.08019.78
7.0.50.0070.04317.93
7.0.40.0030.08720.25
7.0.30.0170.09020.23
7.0.20.0270.06720.06
7.0.10.0070.04020.26
7.0.00.0030.07720.29
5.6.210.0100.03720.65
5.6.200.0100.08018.18
5.6.190.0170.07320.52
5.6.180.0770.06020.58
5.6.170.0170.04720.46
5.6.160.0030.06720.50
5.6.150.0070.08318.17
5.6.140.0070.04318.16
5.6.130.0100.07718.11
5.6.120.0070.08320.94
5.6.110.0030.07320.98
5.6.100.0170.08320.99
5.6.90.0100.08721.11
5.6.80.0100.07720.41
5.5.350.0200.06320.41
5.5.340.0070.04317.94
5.5.330.0100.08020.41
5.5.320.0500.06020.27
5.5.310.0200.03320.32
5.5.300.0130.07318.13
5.5.290.0030.08317.95
5.5.280.0170.08020.86
5.5.270.0030.04020.89
5.5.260.0070.05320.68
5.5.250.0030.09020.61
5.5.240.0170.08320.05
5.4.450.0930.04019.46
5.4.440.1070.06019.20
5.4.430.1000.05019.57
5.4.420.0670.00019.39
5.4.410.0630.00019.41
5.4.400.0630.00019.25
5.4.390.0630.00019.13
5.4.380.0670.00019.09
5.4.370.0630.00019.02
5.4.360.0600.00019.06
5.4.350.0630.00019.16
5.4.340.0630.00019.03
5.4.320.0050.03712.50
5.4.310.0080.04012.50
5.4.300.0100.03512.50
5.4.290.0070.03712.50
5.4.280.0080.03312.40
5.4.270.0080.03612.40
5.4.260.0060.03912.40
5.4.250.0040.03912.40
5.4.240.0070.03512.39
5.4.230.0060.03812.39
5.4.220.0090.03312.39
5.4.210.0050.03812.39
5.4.200.0070.04512.39
5.4.190.0080.03512.39
5.4.180.0080.04112.39
5.4.170.0040.04012.40
5.4.160.0090.03812.39
5.4.150.0050.03612.39
5.4.140.0080.04812.07
5.4.130.0040.03612.06
5.4.120.0050.04012.02
5.4.110.0030.03912.02
5.4.100.0100.03012.01
5.4.90.0110.03512.02
5.4.80.0060.04812.02
5.4.70.0060.03512.01
5.4.60.0060.03512.02
5.4.50.0080.03412.01
5.4.40.0080.03312.00
5.4.30.0090.04011.99
5.4.20.0060.04012.00
5.4.10.0050.03512.00
5.4.00.0030.04011.48
5.3.290.0100.03612.80
5.3.280.0080.05412.71
5.3.270.0040.04112.72
5.3.260.0030.04112.72
5.3.250.0050.03712.72
5.3.240.0080.03712.72
5.3.230.0050.03712.70
5.3.220.0040.03812.68
5.3.210.0050.03912.68
5.3.200.0050.03912.68
5.3.190.0090.03412.68
5.3.180.0060.03612.67
5.3.170.0080.03212.67
5.3.160.0050.03612.67
5.3.150.0060.03612.67
5.3.140.0060.04212.66
5.3.130.0070.03712.66
5.3.120.0060.03712.66
5.3.110.0040.03912.66
5.3.100.0070.03512.13
5.3.90.0040.03812.11
5.3.80.0090.03212.10
5.3.70.0080.03312.09
5.3.60.0090.03312.08
5.3.50.0050.03612.03
5.3.40.0050.04312.03
5.3.30.0080.04111.99
5.3.20.0070.03311.79
5.3.10.0060.03311.73
5.3.00.0050.03611.72
5.2.170.0060.0289.23
5.2.160.0050.0289.23
5.2.150.0040.0309.23
5.2.140.0050.0349.22
5.2.130.0050.0399.18
5.2.120.0020.0309.18
5.2.110.0040.0299.20
5.2.100.0040.0369.19
5.2.90.0030.0309.18
5.2.80.0060.0289.18
5.2.70.0050.0289.18
5.2.60.0020.0319.13
5.2.50.0030.0319.10
5.2.40.0050.0319.07
5.2.30.0060.0289.06
5.2.20.0050.0279.05
5.2.10.0040.0288.96
5.2.00.0020.0318.81
5.1.60.0050.0228.09
5.1.50.0040.0248.09
5.1.40.0060.0228.08
5.1.30.0050.0248.43
5.1.20.0030.0278.44
5.1.10.0050.0308.17
5.1.00.0050.0238.17
5.0.50.0040.0196.65
5.0.40.0040.0246.50
5.0.30.0000.0346.32
5.0.20.0020.0206.29
5.0.10.0030.0206.27
5.0.00.0050.0296.25
4.4.90.0040.0134.78
4.4.80.0040.0144.76
4.4.70.0040.0144.76
4.4.60.0020.0164.75
4.4.50.0050.0144.77
4.4.40.0050.0234.71
4.4.30.0020.0214.76
4.4.20.0040.0224.84
4.4.10.0040.0154.85
4.4.00.0060.0234.75
4.3.110.0020.0194.67
4.3.100.0050.0224.66
4.3.90.0010.0164.63
4.3.80.0050.0214.58
4.3.70.0000.0164.63
4.3.60.0040.0124.63
4.3.50.0050.0124.63
4.3.40.0010.0254.53
4.3.30.0020.0163.30
4.3.20.0010.0163.28
4.3.10.0030.0163.23
4.3.00.0130.0278.06

preferences:
66.34 ms | 401 KiB | 5 Q