PHP 8 · Strings and arrays

Extract a column

Pull one field from each row.

$emails = array_column($users, 'email');

Official PHP 8 documentation

More strings and arrays commands

All strings and arrays commands · PHP 8 cheatsheet

Was this page helpful?