- array_column: documentation ( source)
- var_export: documentation ( source)
<?php
$indexed = [
(object)['id' => 'john', 'name' => 'John', 'age' => 29],
(object)['id' => 'peter', 'name' => 'Peter', 'age' => 30],
(object)['id' => 'harry', 'name' => 'Harry', 'age' => 19],
];
var_export(array_column($indexed, null, 'id'));