PHP 5
array_column
doesn’t work with an array of objects. Use array_map
instead:
$titles = array_map(function($e) {
return is_object($e) ? $e->Title : $e['Title'];
}, $records);
PHP 7
array_column()
The function now supports an array of objects as well as
two-dimensional arrays. Only public properties are considered, and
objects that make use of__get()
for dynamic properties must also
implement__isset()
.
See https://github.com/php/php-src/blob/PHP-7.0.0/UPGRADING#L629 –
Thanks to Bell for the hint!