Unexpected results when using `array_map` with objects in PHP 8.2
This might be a silly question, but After trying multiple solutions online, I still can't figure this out. I'm experiencing unexpected behavior when using `array_map` with an array of objects in PHP 8.2. I have a class `User` with a method `getFullName` that concatenates the first and last names. Here's a simplified version of my code: ```php class User { public $firstName; public $lastName; public function __construct($firstName, $lastName) { $this->firstName = $firstName; $this->lastName = $lastName; } public function getFullName() { return $this->firstName . ' ' . $this->lastName; } } $users = [ new User('John', 'Doe'), new User('Jane', 'Smith'), new User('Alice', 'Johnson') ]; $fullNames = array_map(function($user) { return $user->getFullName(); }, $users); print_r($fullNames); ``` When I run this code, I expect to get an array of full names like this: ``` Array ( [0] => John Doe [1] => Jane Smith [2] => Alice Johnson ) ``` However, I am receiving the following output: ``` Array ( [0] => Array ( [firstName] => John [lastName] => Doe ) [1] => Array ( [firstName] => Jane [lastName] => Smith ) [2] => Array ( [firstName] => Alice [lastName] => Johnson ) ) ``` It appears that instead of executing the `getFullName` method, it's somehow returning the object itself. I've double-checked that the `getFullName` method is correctly defined and accessible. I've also tried adding type hints and fixing visibility, but nothing seems to work. Is there something I'm missing or is there a known issue with `array_map` when used in this manner in PHP 8.2? I'm working in a Ubuntu 22.04 environment.