- array_column: documentation ( source)
- print_r: documentation ( source)
<?php
$object1 = (object)['id' => 1, 'name' => 'one'];
$object2 = (object)['id' => 2, 'name' => 'two'];
$object3 = (object)['id' => 3, 'name' => 'three'];
$objects = [$object1, $object2, $object3];
print_r(array_column($objects, 'id'));