3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr= [ ['attr_id' => 1,'name' => 'qty','value' =>'100'], ['attr_id' => 1,'name'=>'qty','value'=>'200'], ['attr_id'=>1,'name'=>'qty','value'=>'500'], ['attr_id'=>2,'name'=>'price','value'=>'10$']]; $value = array_column($arr, 'value'); $id = array_column($arr, 'attr_id'); $res =[]; Foreach($id as $key => $i){ If(!isset($res[$i])) $res[$i] = ['attr_id' => $i, 'name'=>'qty', 'value' => []]; $res[$i]['value'][] = $value[$key]; } Var_dump($res);

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.5.30.0100.00819.36
8.5.20.0110.00619.58
8.5.10.0090.00916.49
8.5.00.0080.01319.83
8.4.180.0150.00722.03
8.4.170.0150.00823.89
8.4.160.0140.00823.99
8.4.150.0070.00516.89
8.4.140.0170.00617.73
8.4.130.0100.01217.88
8.4.120.0150.00520.63
8.4.110.0050.00422.61
8.4.100.0130.00817.97
8.4.90.0100.00818.75
8.4.80.0150.00517.75
8.4.70.0120.00917.50
8.4.60.0120.00818.89
8.4.50.0160.00519.53
8.4.40.0080.00417.77
8.4.30.0100.01019.58
8.4.20.0070.01019.45
8.4.10.0130.00717.55
8.3.300.0090.01120.67
8.3.290.0130.00720.67
8.3.280.0110.00918.42
8.3.270.0100.00916.52
8.3.260.0080.00916.54
8.3.250.0120.00718.88
8.3.240.0100.01016.57
8.3.230.0140.00616.56
8.3.220.0130.00417.18
8.3.210.0060.00216.52
8.3.200.0040.00516.83
8.3.190.0060.00317.32
8.3.180.0080.01116.49
8.3.170.0090.01019.04
8.3.160.0070.01116.69
8.3.150.0070.01317.48
8.3.140.0040.00417.32
8.3.130.0030.00718.39
8.3.120.0000.00820.96
8.3.110.0080.00016.49
8.3.100.0000.00918.57
8.3.90.0080.00016.63
8.3.80.0050.00517.97
8.3.70.0090.00916.75
8.3.60.0150.00418.27
8.3.50.0100.00718.18
8.3.40.0130.00618.96
8.3.30.0030.01218.71
8.3.20.0060.00319.27
8.3.10.0080.00019.24
8.3.00.0080.00023.33
8.2.300.0130.01023.93
8.2.290.0120.00720.43
8.2.280.0070.00720.04
8.2.270.0130.00617.27
8.2.260.0070.01118.71
8.2.250.0090.00616.63
8.2.240.0100.00717.33
8.2.230.0110.00720.94
8.2.220.0040.00424.06
8.2.210.0070.00726.77
8.2.200.0070.00318.35
8.2.190.0140.00316.58
8.2.180.0150.00318.29
8.2.170.0030.01322.96
8.2.160.0120.00321.20
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0070.00019.60
8.2.120.0040.00426.35
8.2.110.0030.00621.03
8.2.100.0090.00317.78
8.2.90.0090.00019.23
8.2.80.0000.00817.97
8.2.70.0000.00817.63
8.2.60.0040.00418.03
8.2.50.0090.00018.07
8.2.40.0040.00420.07
8.2.30.0040.00418.07
8.2.20.0040.00418.00
8.2.10.0040.00418.06
8.2.00.0000.00719.55
8.1.340.0100.00917.48
8.1.330.0060.00222.06
8.1.320.0120.00816.16
8.1.310.0030.00516.66
8.1.300.0070.01118.33
8.1.290.0030.00718.88
8.1.280.0060.01225.92
8.1.270.0040.00423.99
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0090.00022.75
8.1.230.0070.00419.08
8.1.220.0040.00417.77
8.1.210.0040.00418.77
8.1.200.0000.00917.25
8.1.190.0040.00417.13
8.1.180.0040.00418.10
8.1.170.0030.00518.59
8.1.160.0060.00318.94
8.1.150.0050.00218.89
8.1.140.0000.00717.70
8.1.130.0000.00719.06
8.1.120.0000.00717.47
8.1.110.0080.00017.39
8.1.100.0000.00917.36
8.1.90.0030.00617.45
8.1.80.0040.00417.35
8.1.70.0000.00717.50
8.1.60.0060.00317.55
8.1.50.0060.00317.41
8.1.40.0040.00417.40
8.1.30.0030.00517.52
8.1.20.0000.00717.64
8.1.10.0000.00717.41
8.1.00.0060.00317.40
8.0.300.0060.00318.77
8.0.290.0020.00516.63
8.0.280.0000.00818.49
8.0.270.0070.00017.17
8.0.260.0060.00017.16
8.0.250.0000.00716.99
8.0.240.0000.00716.93
8.0.230.0000.00716.80
8.0.220.0070.00016.87
8.0.210.0030.00316.89
8.0.200.0000.00716.89
8.0.190.0040.00416.90
8.0.180.0000.00816.97
8.0.170.0030.00516.87
8.0.160.0090.00316.88
8.0.150.0000.00716.84
8.0.140.0050.00316.77
8.0.130.0060.00013.36
8.0.120.0040.00416.86
8.0.110.0040.00416.91
8.0.100.0070.00016.78
8.0.90.0000.00816.84
8.0.80.0110.00816.86
8.0.70.0050.00216.83
8.0.60.0020.00516.76
8.0.50.0070.00016.89
8.0.30.0120.00617.08
8.0.20.0060.01217.40
8.0.10.0040.00416.89
8.0.00.0100.00816.66
7.4.330.0000.00615.55
7.4.320.0030.00316.59
7.4.300.0040.00416.49
7.4.290.0030.00316.62
7.4.280.0060.00316.51
7.4.270.0040.00716.50
7.4.260.0000.00716.47
7.4.250.0070.00016.46
7.4.240.0070.00016.60
7.4.230.0030.00316.42
7.4.220.0000.00816.68
7.4.210.0070.01216.50
7.4.200.0050.00216.71
7.4.160.0120.00616.63
7.4.140.0120.00817.86
7.4.130.0110.00616.41
7.4.120.0110.00916.63
7.4.110.0030.01416.45
7.4.100.0090.01316.48
7.4.90.0120.01216.41
7.4.80.0090.01219.39
7.4.70.0090.00916.52
7.4.60.0110.00716.59
7.4.50.0040.01116.26
7.4.40.0070.01016.69
7.4.00.0030.01415.09
7.3.330.0000.00613.09
7.3.320.0000.00513.24
7.3.310.0040.00416.40
7.3.300.0000.00716.32
7.3.290.0000.00716.25
7.3.280.0100.00816.36
7.3.260.0100.01016.38
7.3.240.0090.01016.40
7.3.230.0090.00916.33
7.3.210.0070.01116.61
7.3.200.0070.01016.36
7.3.190.0080.00916.39
7.3.180.0070.01316.68
7.3.170.0130.00316.60
7.3.160.0100.00616.61
7.2.330.0030.01416.45
7.2.320.0150.00416.57
7.2.310.0140.00916.74
7.2.300.0060.01016.73
7.2.290.0060.01516.50
7.2.60.1990.00815.00
7.2.50.2810.01015.02
7.2.41.1850.01415.44
7.2.31.1140.00615.54
7.2.20.9320.00715.33
7.2.10.8840.00815.43
7.2.00.8530.00915.49
7.1.200.0000.01115.95
7.1.170.0300.00713.70
7.1.160.1460.01016.68
7.1.150.0180.00816.93
7.1.141.0150.01316.75
7.1.130.9890.00916.78
7.1.120.0160.01316.49
7.1.110.0280.01216.23
7.1.100.0240.01116.36
7.1.90.0220.01016.27
7.1.80.1080.01016.01
7.1.70.1430.01015.46
7.1.60.0280.01433.00
7.1.50.0370.01533.04
7.1.40.0420.01632.64
7.1.30.0350.01132.63
7.1.20.3670.01432.80
7.1.10.0490.00914.90
7.1.00.1410.01114.63

preferences:
109.36 ms | 1485 KiB | 5 Q