I have a list of objects ( Cars ) so cars[0]->getId() is 12, cars[1]->getId is 25 etc. I want to fill an array with these IDs without using foreach
Currently I am doing it like this:
$carIds = array()
foreach ($cars as $car) {
$carIds[] = $car->getId();
}
Is there an in built function to directly populate the array?