How to iterate an array to count elements PHP?
I wanna know how to iterate an array to count elements in PHP, I've trying next, foreach ($items as $item) { $tm[$item->provider->name] = []; foreach ($items as $item) { $tm[$item->provider->name][$item->product->brand->name] = isset($tm[$item->provider->name][$item->product->brand->name]) ? $tm[$item->provider->name][$item->product->brand->name] + 1 : $tm[$item->provider->name][$item->product->brand->name] = 1;…