3v4l.org

run code in 300+ PHP versions simultaneously
<?php $mapping = [ "AccountId" => "id", "Street" => "street_name", "Country" => "country", "Contacts" => "contacts", "Id" => "contact_id", "Name" => "name" ]; $input2 = [ "AccountId" => "18", "Street" => "Some Street 123", "Country" => "England", "Contacts" => [ [ "Id" => "1234", "Name" => "John Doe" ] ] ]; function mapArray($mapping, $input) { $output = []; foreach ($mapping as $from => $to) { if (array_key_exists($from, $input)) { if (is_array($input[$from])) { $output[$to] = mapArray($mapping, $input[$from]); } else { echo $input[$from]; $output[$to] = $input[$from]; } } } return $output; } $output2 = mapArray($mapping, $input2); var_dump($output2);

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.0100.00716.50
8.3.50.0070.00716.59
8.3.40.0150.00018.89
8.3.30.0090.00618.84
8.3.20.0040.00420.21
8.3.10.0080.00021.73
8.3.00.0050.00320.77
8.2.180.0110.00318.29
8.2.170.0150.00022.96
8.2.160.0070.00721.95
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0080.00022.23
8.2.120.0080.00026.35
8.2.110.0090.00022.14
8.2.100.0110.00017.91
8.2.90.0000.00819.30
8.2.80.0000.00818.04
8.2.70.0040.00417.38
8.2.60.0000.00817.93
8.2.50.0050.00318.10
8.2.40.0040.00422.18
8.2.30.0000.00821.00
8.2.20.0040.00418.16
8.2.10.0040.00418.09
8.2.00.0050.00318.13
8.1.270.0080.00022.14
8.1.260.0080.00026.35
8.1.250.0070.00728.09
8.1.240.0060.00323.88
8.1.230.0080.00322.14
8.1.220.0100.00017.74
8.1.210.0040.00418.77
8.1.200.0000.00917.35
8.1.190.0040.00417.36
8.1.180.0060.00318.10
8.1.170.0030.00618.57
8.1.160.0080.00018.94
8.1.150.0000.00718.91
8.1.140.0040.00417.45
8.1.130.0050.00219.02
8.1.120.0060.00317.39
8.1.110.0000.00717.44
8.1.100.0000.00717.44
8.1.90.0000.00817.36
8.1.80.0070.00017.53
8.1.70.0060.00317.46
8.1.60.0000.00917.53
8.1.50.0030.00517.37
8.1.40.0040.00417.58
8.1.30.0040.00417.68
8.1.20.0030.00517.68
8.1.10.0040.00417.59
8.1.00.0040.00417.48
8.0.300.0000.00718.77
8.0.290.0080.00016.75
8.0.280.0000.00718.45
8.0.270.0000.00717.27
8.0.260.0000.00716.73
8.0.250.0000.00816.91
8.0.240.0030.00516.77
8.0.230.0040.00416.91
8.0.220.0030.00316.88
8.0.210.0030.00316.91
8.0.200.0030.00316.93
8.0.190.0030.00516.95
8.0.180.0050.00516.83
8.0.170.0040.00416.96
8.0.160.0030.00516.91
8.0.150.0040.00416.80
8.0.140.0000.00716.87
8.0.130.0000.00713.25
8.0.120.0000.00716.88
8.0.110.0030.00516.83
8.0.100.0000.00716.81
8.0.90.0000.00716.77
8.0.80.0060.01016.96
8.0.70.0060.00316.74
8.0.60.0050.00216.79
8.0.50.0040.00416.73
8.0.30.0090.01017.12
8.0.20.0110.01117.42
8.0.10.0050.00317.09
8.0.00.0090.00916.60
7.4.330.0050.00015.55
7.4.320.0000.00616.56
7.4.300.0030.00316.61
7.4.290.0000.00816.50
7.4.280.0040.00416.60
7.4.270.0000.00716.37
7.4.260.0040.00416.46
7.4.250.0040.00416.39
7.4.240.0040.00416.52
7.4.230.0050.00216.69
7.4.220.0140.00716.71
7.4.210.0110.00416.69
7.4.200.0000.00716.54
7.4.160.0090.00916.51
7.4.150.0130.00717.40
7.4.140.0120.00517.86
7.4.130.0110.01216.38
7.4.120.0140.00816.59
7.4.110.0080.00816.49
7.4.100.0090.01216.55
7.4.90.0100.01316.68
7.4.80.0080.00919.39
7.4.70.0080.00816.55
7.4.60.0080.00816.59
7.4.50.0000.01316.33
7.4.40.0060.00916.45
7.4.30.0070.01016.65
7.4.00.0050.01314.85
7.3.330.0030.00313.38
7.3.320.0000.00513.36
7.3.310.0030.00316.37
7.3.300.0070.00016.24
7.3.290.0060.01116.33
7.3.280.0080.00916.32
7.3.270.0140.00317.40
7.3.260.0070.01116.33
7.3.250.0100.01016.46
7.3.240.0120.00716.30
7.3.230.0100.00616.61
7.3.210.0100.00716.45
7.3.200.0130.00316.49
7.3.190.0030.01316.54
7.3.180.0110.00516.73
7.3.170.0140.00416.52
7.3.160.0060.01116.47
7.3.120.0040.01214.80
7.3.110.0030.01615.04
7.3.100.0100.01014.56
7.3.90.0090.00314.67
7.3.80.0140.00015.00
7.3.70.0030.00714.92
7.3.60.0030.01314.98
7.3.50.0040.01114.87
7.3.40.0120.00614.79
7.3.30.0070.00714.89
7.3.20.0070.00716.68
7.3.10.0070.00716.77
7.3.00.0030.01016.61
7.2.330.0080.01016.81
7.2.320.0090.00816.78
7.2.310.0140.00316.64
7.2.300.0120.00416.50
7.2.290.0060.01116.71
7.2.250.0060.01315.38
7.2.240.0070.01114.79
7.2.230.0090.00615.28
7.2.220.0040.01114.87
7.2.210.0030.00715.03
7.2.200.0030.01015.07
7.2.190.0030.01215.26
7.2.180.0060.01314.88
7.2.170.0030.01315.26
7.2.160.0030.01015.27
7.2.150.0110.00316.72
7.2.140.0100.00717.03
7.2.130.0040.00817.10
7.2.120.0070.00316.82
7.2.110.0060.00916.93
7.2.100.0060.00616.90
7.2.90.0080.00316.93
7.2.80.0040.01116.92
7.2.70.0030.00917.15
7.2.60.0050.00917.01
7.2.50.0060.01016.79
7.2.40.0070.00716.96
7.2.30.0070.00716.99
7.2.20.0100.00317.12
7.2.10.0120.00617.05
7.2.00.0040.01118.25
7.1.330.0130.00315.95
7.1.320.0100.00615.98
7.1.310.0110.00815.75
7.1.300.0030.01415.99
7.1.290.0030.01015.96
7.1.280.0040.00415.77
7.1.270.0030.01215.86
7.1.260.0000.01015.91
7.1.250.0060.00315.60
7.1.240.0030.01015.94
7.1.230.0050.00515.77
7.1.220.0060.00615.79
7.1.210.0040.00415.80
7.1.200.0090.00315.67
7.1.190.0030.00716.00
7.1.180.0000.01715.80
7.1.170.0030.00715.83
7.1.160.0000.00916.01
7.1.150.0100.00615.96
7.1.140.0120.00615.82
7.1.130.0080.00415.93
7.1.120.0030.00615.94
7.1.110.0030.00915.98
7.1.100.0060.00716.97
7.1.90.0000.01515.84
7.1.80.0000.01315.92
7.1.70.0030.01416.59
7.1.60.0170.01324.52
7.1.50.0180.01224.38
7.1.40.0250.00724.11
7.1.30.0300.00924.14
7.1.20.0160.01324.35
7.1.10.0150.01115.24
7.1.00.0130.01015.42
7.0.330.0060.00615.59
7.0.320.0000.01515.48
7.0.310.0060.00815.40
7.0.300.0100.00615.49
7.0.290.0100.00315.38
7.0.280.0030.01015.55
7.0.270.0050.00315.34
7.0.260.0030.01015.39
7.0.250.0030.00915.52
7.0.240.0060.00615.43
7.0.230.0030.00715.33
7.0.220.0110.00415.60
7.0.210.0030.01015.47
7.0.200.0200.00915.21
7.0.190.0250.00515.15
7.0.180.0150.00715.00
7.0.170.0150.01014.93
7.0.160.0150.00815.03
7.0.150.0100.01615.08
7.0.140.0230.00815.08
7.0.130.0160.00814.88
7.0.120.0150.00915.15
7.0.110.0230.00714.90
7.0.100.0200.01114.94
7.0.90.0160.00914.85
7.0.80.0540.00914.97
7.0.70.0230.00814.98
7.0.60.0150.00814.89
7.0.50.0180.00315.24
7.0.40.0120.01214.19
7.0.30.0180.00513.97
7.0.20.0130.01113.99
7.0.10.0200.00514.03
7.0.00.0170.00714.21
5.6.400.0030.01214.34
5.6.390.0000.01314.28
5.6.380.0100.00714.46
5.6.370.0090.00614.09
5.6.360.0070.00314.32
5.6.350.0000.01114.29
5.6.340.0100.00314.25
5.6.330.0030.01014.18
5.6.320.0030.01314.72
5.6.310.0070.00414.80
5.6.300.0070.00714.43
5.6.290.0070.00314.14
5.6.280.0000.01014.16
5.6.270.0040.01414.53
5.6.260.0040.00414.45
5.6.250.0050.00514.71
5.6.240.0040.01114.61
5.6.230.0030.01014.63
5.6.220.0100.00314.57
5.6.210.0040.00814.67
5.6.200.0000.01314.48
5.6.190.0060.00914.34
5.6.180.0060.00614.15
5.6.170.0030.00914.59
5.6.160.0070.00414.30
5.6.150.0070.00714.43
5.6.140.0070.00714.24
5.6.130.0030.01014.29
5.6.120.0040.00814.41
5.6.110.0070.01014.30
5.6.100.0130.00014.61
5.6.90.0030.01014.29
5.6.80.0040.01114.27
5.6.70.0030.00914.55
5.6.60.0060.00614.44
5.6.50.0090.00613.98
5.6.40.0070.00314.44
5.6.30.0070.00714.33
5.6.20.0030.01314.25
5.6.10.0000.01014.40
5.6.00.0040.01114.39

preferences:
50.67 ms | 400 KiB | 5 Q