1, "name" => "Alice", "email" => "alice@example.com"], ["id" => 2, "name" => "Bob", "email" => "bob@example.com"], ["id" => 3, "name" => "Charlie", "email" => "charlie@example.com"] ]; // Extract only the 'name' column $names = array_column($users, 'name'); echo "User Names: "; print_r($names); // Extract the 'email' column, using 'id' as the keys $emailsById = array_column($users, 'email', 'id'); echo " User Emails by ID: "; print_r($emailsById); // Example with objects class Product { public $id; public $name; public $price; public function __construct($id, $name, $price) { $this->id = $id; $this->name = $name; $this->price = $price; } } $products = [ new Product(101, "Laptop", 1200), new Product(102, "Mouse", 25), new Product(103, "Keyboard", 75) ]; // Extract product names $productNames = array_column($products, 'name'); echo " Product Names: "; print_r($productNames); // Extract product prices, using 'id' as the keys $productPricesById = array_column($products, 'price', 'id'); echo " Product Prices by ID: "; print_r($productPricesById); ?>