1, 'name' => 'Alice', 'email' => 'alice@example.com'], ['id' => 2, 'name' => 'Bob', 'email' => 'bob@example.com'], ['id' => 3, 'name' => 'Charlie', 'email' => 'charlie@example.com'] ]; // Get all user IDs $ids = array_column($users, 'id'); print_r($ids); // Output: Array ( [0] => 1 [1] => 2 [2] => 3 ) // Get all user names, using 'id' as the keys $namesById = array_column($users, 'name', 'id'); print_r($namesById); // Output: Array ( [1] => Alice [2] => Bob [3] => Charlie ) $products = [ (object)['product_id' => 101, 'product_name' => 'Laptop', 'price' => 1200], (object)['product_id' => 102, 'product_name' => 'Keyboard', 'price' => 75] ]; // Works with objects too (PHP 7.0+) $productNames = array_column($products, 'product_name'); print_r($productNames); // Output: Array ( [0] => Laptop [1] => Keyboard ) ?>