3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = <<<EOL [ { "tax": "10", "concept": "TUC", "val": "10" }, { "tax": "10", "concept": "TUC", "val": "86" }, { "tax": "15", "concept": "TUC", "val": "8" }, { "tax": "11", "concept": "IPS", "val": "6" }, { "tax": "11", "concept": "IPS", "val": "45" } ] EOL; $array = json_decode($str); $result = array_reduce($array, function($carry, $item) { if(!isset($carry[$item->tax])) { $carry[$item->tax] = $item; } else { $carry[$item->tax]->val += $item->val; } return $carry; }); $result = array_values($result); print_r(json_encode($result));

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.130.0040.00818.86
8.3.120.0060.00319.08
8.3.110.0130.00320.94
8.3.100.0040.01124.06
8.3.90.0080.00026.77
8.3.80.0170.00626.14
8.3.70.0000.01516.88
8.3.60.0100.01318.40
8.3.50.0120.00722.18
8.3.40.0140.00718.89
8.3.30.0140.00718.80
8.3.20.0120.00221.79
8.3.10.0070.00521.72
8.3.00.0090.00519.47
8.2.250.0140.00416.75
8.2.240.0060.00318.93
8.2.230.0050.00322.58
8.2.220.0090.00037.54
8.2.210.0000.00826.77
8.2.200.0030.00616.88
8.2.190.0140.00416.58
8.2.180.0080.00825.92
8.2.170.0140.00718.90
8.2.160.0040.01122.96
8.2.150.0060.00722.35
8.2.140.0100.00422.53
8.2.130.0070.00623.35
8.2.120.0030.01019.95
8.2.110.0080.00720.20
8.2.100.0090.00718.76
8.2.90.0110.00719.00
8.2.80.0100.00718.74
8.2.70.0120.00518.50
8.2.60.0120.00718.57
8.2.50.0090.00518.61
8.2.40.0090.00618.56
8.2.30.0070.00518.59
8.2.20.0090.00718.58
8.2.10.0090.00818.66
8.2.00.0080.00718.83
8.1.300.0110.00420.20
8.1.290.0060.00318.88
8.1.280.0070.01425.92
8.1.270.0030.01223.08
8.1.260.0040.00724.18
8.1.250.0100.00125.08
8.1.240.0100.00419.63
8.1.230.0100.00719.67
8.1.220.0060.00818.47
8.1.210.0080.00419.36
8.1.200.0070.00618.34
8.1.190.0070.00518.32
8.1.180.0080.00418.35
8.1.170.0110.00518.42
8.1.160.0070.00818.57
8.1.150.0120.00419.06
8.1.140.0090.00518.69
8.1.130.0110.00318.43
8.1.120.0090.00518.27
8.1.110.0090.00418.19
8.1.100.0100.00318.06
8.1.90.0080.00518.08
8.1.80.0100.00318.28
8.1.70.0060.00718.12
8.1.60.0100.00418.17
8.1.50.0090.00518.12
8.1.40.0120.00218.22
8.1.30.0110.00318.29
8.1.20.0070.00718.68
8.1.10.0070.00718.47
8.1.00.0090.00518.42
8.0.300.0080.00418.02
8.0.290.0120.00417.62
8.0.280.0100.00617.98
8.0.270.0090.00717.70
8.0.260.0120.00417.83
8.0.250.0140.00517.58
8.0.240.0140.00417.64
8.0.230.0080.00817.51
8.0.220.0080.00517.48
8.0.210.0080.00617.41
8.0.200.0120.00417.45
8.0.190.0110.00617.50
8.0.180.0090.00617.51
8.0.170.0100.00517.48
8.0.160.0100.00517.49
8.0.150.0120.00517.44
8.0.140.0110.00517.44
8.0.130.0090.00816.96
8.0.120.0110.00617.42
8.0.110.0080.00617.47
8.0.100.0080.00717.47
8.0.90.0080.00817.43
8.0.80.0100.00717.44
8.0.70.0090.00417.47
8.0.60.0130.00217.46
8.0.50.0110.00417.41
8.0.30.0090.00617.39
8.0.20.0080.00917.56
8.0.10.0110.00517.59
8.0.00.0090.00518.35
7.4.330.0090.00415.10
7.4.320.0100.00417.29
7.4.300.0080.00416.99
7.4.290.0090.00517.10
7.4.280.0120.00617.13
7.4.270.0110.00417.12
7.4.260.0100.00617.00
7.4.250.0100.00617.05
7.4.240.0090.00817.14
7.4.230.0110.00717.09
7.4.220.0120.00417.04
7.4.210.0120.00517.11
7.4.200.0090.00617.11
7.4.190.0080.00717.30
7.4.180.0090.00617.27
7.4.160.0100.00616.96
7.4.150.0100.00617.26
7.4.140.0110.00517.56
7.4.130.0130.00416.97
7.4.120.0120.00616.87
7.4.110.0120.00716.98
7.4.100.0140.00616.97
7.4.90.0130.00616.86
7.4.80.0150.00617.31
7.4.70.0130.00916.89
7.4.60.0150.00716.95
7.4.50.0160.00516.79
7.4.40.0160.00616.90
7.4.30.0140.00616.96
7.4.20.0130.00716.89
7.4.10.0140.00516.61
7.4.00.0090.00716.14
7.3.330.0110.00416.61
7.3.320.0190.00216.55
7.3.310.0140.00716.99
7.3.300.0160.00517.03
7.3.290.0140.00816.84
7.3.280.0150.00616.67
7.3.270.0160.00417.04
7.3.260.0130.00716.96
7.3.250.0140.00516.79
7.3.240.0120.00616.87
7.3.230.0150.00616.94
7.3.220.0150.00616.95
7.3.210.0190.00516.83
7.3.200.0140.00716.86
7.3.190.0170.00516.92
7.3.180.0190.00316.89
7.3.170.0170.00517.15
7.3.160.0170.00716.84
7.3.150.0160.00616.88
7.3.140.0160.00516.81
7.3.130.0120.00816.45
7.3.120.0130.00616.18
7.3.110.0130.00716.20
7.3.100.0120.00716.04
7.3.90.0130.00616.25
7.3.80.0110.00715.90
7.3.70.0100.00716.02
7.3.60.0120.00515.85
7.3.50.0100.00615.78
7.3.40.0090.00715.78
7.3.30.0130.00615.81
7.3.20.0130.00716.61
7.3.10.0150.00616.53
7.3.00.0170.00616.55
7.2.340.0130.00517.31
7.2.330.0170.00616.89
7.2.320.0170.00416.94
7.2.310.0150.00716.92
7.2.300.0170.00516.95
7.2.290.0170.00616.95
7.2.280.0150.00716.96
7.2.270.0160.00516.97
7.2.260.0130.00716.56
7.2.250.0140.00616.28
7.2.240.0150.00516.26
7.2.230.0140.00716.35
7.2.220.0140.00616.24
7.2.210.0100.00916.12
7.2.200.0120.00616.19
7.2.190.0090.00815.94
7.2.180.0110.00716.04
7.2.170.0110.00615.94
7.2.160.0110.00716.00
7.2.150.0200.00816.69
7.2.140.0130.00816.71
7.2.130.0140.00616.77
7.2.120.0150.00716.73
7.2.110.0130.00716.74
7.2.100.0170.00616.71
7.2.90.0140.00616.63
7.2.80.0150.00716.65
7.2.70.0220.00616.70
7.2.60.0140.00816.70
7.2.50.0140.00816.66
7.2.40.0160.00716.68
7.2.30.0150.00716.64
7.2.20.0150.00816.66
7.2.10.0140.00716.74
7.2.00.0100.00916.70
7.1.330.0110.00616.42
7.1.320.0140.00516.43
7.1.310.0210.00616.08
7.1.300.0130.00615.75
7.1.290.0150.00515.66
7.1.280.0150.00515.60
7.1.270.0140.00615.68
7.1.260.0140.00615.62
7.1.250.0160.00615.61
7.1.240.0230.00815.55
7.1.230.0150.00715.51
7.1.220.0170.00615.63
7.1.210.0140.00915.47
7.1.200.0180.00615.51
7.1.190.0330.00815.55
7.1.180.0160.00715.49
7.1.170.0350.00915.53
7.1.160.0220.00715.49
7.1.150.0170.00715.49
7.1.140.0240.00815.44
7.1.130.0180.00815.51
7.1.120.0270.00515.54
7.1.110.0150.00715.55
7.1.100.0150.00815.48
7.1.90.0250.00615.50
7.1.80.0150.00715.48
7.1.70.0160.00715.55
7.1.60.0160.00616.62
7.1.50.0220.00716.61
7.1.40.0150.00816.54
7.1.30.0180.00816.60
7.1.20.0170.00916.59
7.1.10.0130.00615.54
7.1.00.0180.00615.54
7.0.330.0180.00815.18
7.0.320.0170.00815.22
7.0.310.0300.00615.16
7.0.300.0180.00715.07
7.0.290.0180.00715.07
7.0.280.0160.00615.09
7.0.270.0160.00615.13
7.0.260.0210.00715.13
7.0.250.0170.00615.20
7.0.240.0230.00715.18
7.0.230.0170.00615.23
7.0.220.0210.00615.14
7.0.210.0210.00815.16
7.0.200.0160.00515.25
7.0.190.0190.00715.26
7.0.180.0340.00715.24
7.0.170.0150.00715.28
7.0.160.0230.00615.21
7.0.150.0150.00615.17
7.0.140.0170.00815.18
7.0.130.0170.00715.25
7.0.120.0150.00715.25
7.0.110.0150.00715.30
7.0.100.0250.00715.20
7.0.90.0150.00715.18
7.0.80.0210.00515.17
7.0.70.0180.00715.18
7.0.60.0200.00515.17
7.0.50.0150.00515.25
7.0.40.0150.00615.18
7.0.30.0150.00615.19
7.0.20.0160.00515.11
7.0.10.0170.00715.18
7.0.00.0180.00715.13
5.6.400.0140.00715.47
5.6.390.0140.00815.44
5.6.380.0130.00815.37
5.6.370.0160.00615.42
5.6.360.0130.00815.43
5.6.350.0120.00815.40
5.6.340.0150.00615.41
5.6.330.0130.00715.45
5.6.320.0140.00815.39
5.6.310.0140.00715.45
5.6.300.0100.01115.58
5.6.290.0130.00915.66
5.6.280.0130.00815.63
5.6.270.0120.01115.65
5.6.260.0150.00715.72
5.6.250.0120.01015.69
5.6.240.0130.00815.69
5.6.230.0120.00915.76
5.6.220.0140.00815.66
5.6.210.0120.01115.69
5.6.200.0130.00915.66
5.6.190.0120.00915.69
5.6.180.0130.01015.73
5.6.170.0140.00915.69
5.6.160.0140.00915.70
5.6.150.0130.00915.75
5.6.140.0130.00915.71
5.6.130.0140.00915.71
5.6.120.0130.00915.72
5.6.110.0140.00915.63
5.6.100.0140.00915.62
5.6.90.0140.01015.60
5.6.80.0110.01115.58
5.6.70.0130.00815.57
5.6.60.0120.00815.57
5.6.50.0130.00815.55
5.6.40.0130.00915.59
5.6.30.0120.01015.63
5.6.20.0110.01115.53
5.6.10.0120.00915.55
5.6.00.0120.01015.55

preferences:
63.77 ms | 403 KiB | 5 Q