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.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
array ( 0 => array ( 'manufacturer' => 'KInd', 'brand' => 'ABC', 'used' => 'true', 'count' => 2, ), 1 => array ( 'manufacturer' => 'KInd', 'brand' => 'ABC', 'used' => 'false', 'count' => 1, ), )

preferences:
137.59 ms | 407 KiB | 5 Q