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));

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
147.46 ms | 1916 KiB | 14 Q