3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = json_decode('[{ "manufacturer": "KInd", "brand": "ABC", "used": "true" }, { "manufacturer": "KInd", "brand": "ABC", "used": "true" }, { "manufacturer": "KInd", "brand": "ABC", "used": "false" }]', true); $result = []; foreach ($array as $row) { $compositeKey = implode('_', $row); if (!isset($result[$compositeKey])) { $result[$compositeKey] = $row + ['count' => 1]; } else { ++$result[$compositeKey]['count']; } } var_export(array_values($result));
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
array ( 0 => array ( 'manufacturer' => 'KInd', 'brand' => 'ABC', 'used' => 'true', 'count' => 2, ), 1 => array ( 'manufacturer' => 'KInd', 'brand' => 'ABC', 'used' => 'false', 'count' => 1, ), )

preferences:
135.77 ms | 402 KiB | 121 Q