PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
foreach($modules as $module => $module_ids){
foreach($module_ids as $module_id => $value){
$module_ids_count++;
}
}
Because all I am doing is basically counting the number of elements in each sub-array I would much rather simplify the code and *not* use any foreach if possible.
Can anyone think of a one liner to accomplish this, maybe using a combination of array_map or something?
I dunno, the code you have works, I wouldn't spend too much time on it. If it was me I'd try to count them at the source, where the data is entered into the array.