3v4l.org

run code in 300+ PHP versions simultaneously
<?php $original = Array ( 'id' => Array ( 0 => 1, 1 => 3 ), 'reward' => Array ( 0 => 'Movie', 1 => 'Trip' ), 'cost' => Array ( 0 => 50, 1 => 200 ) ); $output = array(); // Iterate the original array's [id] sub-array foreach ($original['id'] as $idxkey => $newkey) { // Add a sub-array using $newkey to the output array $output[$newkey] = array( // Using the index (not value), retrieve the corresponding reward // value to use as the new array key // and corresponding cost to use as the new subarray value $original['reward'][$idxkey] => $original['cost'][$idxkey] ); } print_r($output);

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.70.0160.00316.73
8.3.60.0120.00916.46
8.3.50.0120.00921.27
8.3.40.0040.01118.50
8.3.30.0040.01118.73
8.3.20.0050.00318.77
8.3.10.0050.00321.53
8.3.00.0080.00019.26
8.2.190.0150.00016.75
8.2.180.0120.00318.16
8.2.170.0040.01118.95
8.2.160.0130.00022.96
8.2.150.0080.00025.66
8.2.140.0000.00824.66
8.2.130.0070.00021.06
8.2.120.0000.00826.35
8.2.110.0080.00022.01
8.2.100.0060.00617.91
8.2.90.0080.00017.75
8.2.80.0050.00318.75
8.2.70.0030.00617.38
8.2.60.0040.00417.50
8.2.50.0000.00817.63
8.2.40.0050.00321.10
8.2.30.0040.00420.54
8.2.20.0050.00217.75
8.2.10.0000.00718.12
8.2.00.0080.00018.13
8.1.280.0040.01225.92
8.1.270.0050.00322.19
8.1.260.0080.00028.09
8.1.250.0080.00028.09
8.1.240.0030.00623.80
8.1.230.0140.00019.16
8.1.220.0070.00017.78
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0000.00817.53
8.1.180.0000.00818.10
8.1.170.0000.00818.74
8.1.160.0060.00318.89
8.1.150.0000.00718.77
8.1.140.0000.00819.59
8.1.130.0040.00417.76
8.1.120.0030.00317.47
8.1.110.0080.00017.46
8.1.100.0070.00017.42
8.1.90.0030.00517.48
8.1.80.0000.00717.46
8.1.70.0070.00017.28
8.1.60.0040.00417.59
8.1.50.0020.00517.42
8.1.40.0000.00817.51
8.1.30.0060.00317.50
8.1.20.0000.00817.71
8.1.10.0070.00017.35
8.1.00.0030.00617.53
8.0.300.0000.00818.77
8.0.290.0040.00416.75
8.0.280.0020.00518.51
8.0.270.0030.00317.32
8.0.260.0000.00617.28
8.0.250.0040.00416.94
8.0.240.0040.00416.87
8.0.230.0000.00816.93
8.0.220.0030.00316.88
8.0.210.0050.00216.89
8.0.200.0000.00717.00
8.0.190.0100.00016.88
8.0.180.0080.00016.82
8.0.170.0040.00416.96
8.0.160.0070.00017.01
8.0.150.0040.00416.91
8.0.140.0040.00416.75
8.0.130.0030.00313.29
8.0.120.0030.00616.85
8.0.110.0000.00816.84
8.0.100.0070.00016.79
8.0.90.0040.00416.89
8.0.80.0030.01316.78
8.0.70.0000.00716.92
8.0.60.0000.00716.93
8.0.50.0040.00416.89
8.0.30.0100.00817.05
8.0.20.0100.01317.40
8.0.10.0070.00016.80
8.0.00.0090.01216.58
7.4.330.0000.00615.08
7.4.320.0000.00616.63
7.4.300.0040.00416.46
7.4.290.0030.00516.52
7.4.280.0000.00816.61
7.4.270.0030.00316.66
7.4.260.0030.00316.62
7.4.250.0040.00416.48
7.4.240.0040.00416.54
7.4.230.0030.00316.61
7.4.220.0060.01216.48
7.4.210.0080.00816.62
7.4.200.0000.00716.35
7.4.160.0080.00816.54
7.4.150.0120.00617.40
7.4.140.0100.00917.86
7.4.130.0110.00716.48
7.4.120.0080.00816.56
7.4.110.0120.00716.50
7.4.100.0100.00616.47
7.4.90.0130.00516.43
7.4.80.0090.00817.92
7.4.70.0050.01316.68
7.4.60.0070.01016.53
7.4.50.0050.01116.61
7.4.40.0080.00916.54
7.4.30.0030.01316.47
7.4.20.0000.01716.54
7.4.10.0030.01316.45
7.4.00.0050.01215.71
7.3.330.0050.00013.18
7.3.320.0030.00313.08
7.3.310.0000.00716.17
7.3.300.0000.00716.24
7.3.290.0030.00316.21
7.3.280.0070.01016.35
7.3.270.0090.00917.40
7.3.260.0150.00316.37
7.3.250.0100.00816.43
7.3.240.0130.00916.49
7.3.230.0110.00516.40
7.3.220.0120.00616.31
7.3.210.0080.01116.37
7.3.200.0080.01116.33
7.3.190.0110.00816.45
7.3.180.0030.01316.37
7.3.170.0070.01016.33
7.3.160.0020.01516.43
7.3.150.0100.00616.62
7.3.140.0080.00816.54
7.3.130.0100.00616.49
7.3.120.0030.01416.41
7.3.110.0070.01016.35
7.3.100.0110.00716.52
7.3.90.0080.00816.21
7.3.80.0100.00716.26
7.3.70.0120.00916.27
7.3.60.0160.00616.32
7.3.50.0030.01316.21
7.3.40.0060.01016.16
7.3.30.0060.00916.40
7.3.20.0070.01016.45
7.3.10.0120.00516.46
7.3.00.0150.00616.35
7.2.340.0030.01416.60
7.2.330.0130.00516.69
7.2.320.0120.00816.58
7.2.310.0080.01016.73
7.2.300.0120.00716.55
7.2.290.0070.01316.51
7.2.280.0000.01716.57
7.2.270.0070.01116.47
7.2.260.0000.01716.37
7.2.250.0070.01016.57
7.2.240.0120.00616.79
7.2.230.0080.00816.57
7.2.220.0100.00716.70
7.2.210.0090.00916.66
7.2.200.0070.01716.35
7.2.190.0180.00616.65
7.2.180.0040.01516.60
7.2.170.0120.00616.57
7.2.160.0120.00616.53
7.2.150.0120.00616.64
7.2.140.0060.01616.51
7.2.130.0120.00616.31
7.2.120.0150.00316.53
7.2.110.0100.01016.48
7.2.100.0140.00816.46
7.2.90.0150.00616.52
7.2.80.0150.00316.64
7.2.70.0080.00916.46
7.2.60.0120.00916.55
7.2.50.0110.00916.53
7.2.40.0080.01016.42
7.2.30.0130.00616.40
7.2.20.0120.00816.38
7.2.10.0270.00516.47
7.2.00.0110.00616.65
7.1.330.0640.00715.81
7.1.320.0230.00715.76
7.1.310.0230.00715.61
7.1.300.0230.00815.42
7.1.290.0250.00415.43
7.1.280.0210.00615.52
7.1.270.0160.01215.52
7.1.260.0180.01115.47
7.1.250.0220.00915.51
7.1.240.0210.00715.70
7.1.230.0140.01415.49
7.1.220.0330.00415.51
7.1.210.0240.00415.61
7.1.200.0240.00315.45
7.1.190.0220.00615.54
7.1.180.0180.01515.46
7.1.170.0200.01415.64
7.1.160.0290.00615.60
7.1.150.0270.00015.50
7.1.140.0220.00815.48
7.1.130.0150.01515.64
7.1.120.0230.00615.52
7.1.110.0190.00915.50
7.1.100.0290.00415.63
7.1.90.0250.00315.59
7.1.80.0220.00715.57
7.1.70.0130.00816.19
7.1.60.0150.01317.89
7.1.50.0210.00815.68
7.1.40.0170.01115.64
7.1.30.0230.00915.71
7.1.20.0240.00915.64
7.1.10.0240.00415.61
7.1.00.0170.04119.03
7.0.330.0160.01215.29
7.0.320.0270.00315.17
7.0.310.0190.01015.04
7.0.300.0250.00315.29
7.0.290.0260.00415.21
7.0.280.0200.01215.25
7.0.270.0510.00315.21
7.0.260.0210.00515.33
7.0.250.0170.01315.33
7.0.240.0240.00715.10
7.0.230.0210.00615.29
7.0.220.0220.00615.13
7.0.210.0160.01215.20
7.0.200.0150.00615.91
7.0.190.0200.00815.23
7.0.180.0390.00615.41
7.0.170.0210.00815.39
7.0.160.0180.01415.19
7.0.150.0270.00315.45
7.0.140.0220.00915.30
7.0.130.0220.00915.38
7.0.120.0250.00615.42
7.0.110.0140.01415.21
7.0.100.0240.00415.15
7.0.90.0220.00615.38
7.0.80.0110.01415.32
7.0.70.0070.01115.30
7.0.60.0120.04118.46
7.0.50.0050.02516.58
7.0.40.0200.04017.71
7.0.30.0290.02817.75
7.0.20.0220.03817.67
7.0.10.0210.03217.73
7.0.00.0280.03817.66
5.6.400.0190.01416.11
5.6.390.0200.00716.13
5.6.380.0130.01916.06
5.6.370.0130.01716.21
5.6.360.0160.01316.09
5.6.350.0170.01316.28
5.6.340.0140.01815.84
5.6.330.0100.02015.85
5.6.320.0180.01216.34
5.6.310.0220.00915.95
5.6.300.0250.00616.01
5.6.290.0150.01815.83
5.6.280.0130.04118.47
5.6.270.0220.00916.11
5.6.260.0210.01216.31
5.6.250.0170.01315.66
5.6.240.0180.01216.21
5.6.230.0080.01115.88
5.6.220.0090.01215.93
5.6.210.0130.02718.32
5.6.200.0070.03817.04
5.6.190.0160.03918.56
5.6.180.0150.03418.61
5.6.170.0260.03018.53
5.6.160.0150.03618.37
5.6.150.0070.04018.45
5.6.140.0110.03618.52
5.6.130.0120.03418.52
5.6.120.0140.03218.48
5.6.110.0270.02418.54
5.6.100.0160.03118.55
5.6.90.0150.03418.55
5.6.80.0120.03518.13
5.6.70.0110.03518.13
5.6.60.0160.03118.08
5.6.50.0100.03818.21
5.6.40.0190.03318.18
5.6.30.0070.03718.15
5.6.20.0170.03218.18
5.6.10.0210.02618.16
5.6.00.0100.04018.29
5.5.380.0140.01815.83
5.5.370.0230.00715.91
5.5.360.0210.00915.96
5.5.350.0210.04318.11
5.5.340.0130.02516.98
5.5.330.0210.03718.38
5.5.320.0280.03818.40
5.5.310.0310.03518.31
5.5.300.0160.03718.31
5.5.290.0140.03718.52
5.5.280.0110.03918.41
5.5.270.0230.03318.41
5.5.260.0170.03818.51
5.5.250.0170.03418.31
5.5.240.0190.03117.95
5.5.230.0220.03217.94
5.5.220.0180.03218.04
5.5.210.0210.03417.99
5.5.200.0200.03718.10
5.5.190.0100.04317.96
5.5.180.0190.03418.06
5.5.170.0170.01015.93
5.5.160.0190.03218.04
5.5.150.0190.03318.15
5.5.140.0160.03218.06
5.5.130.0080.04318.09
5.5.120.0130.03818.20
5.5.110.0200.03017.97
5.5.100.0180.03318.00
5.5.90.0210.03118.02
5.5.80.0170.03717.97
5.5.70.0170.03317.87
5.5.60.0140.03118.04
5.5.50.0130.03717.89
5.5.40.0220.02917.97
5.5.30.0170.03617.91
5.5.20.0180.03218.08
5.5.10.0060.04317.88
5.5.00.0160.03417.98

preferences:
25.39 ms | 401 KiB | 5 Q