How can the get_browser() function be used to return an array instead of an object in PHP?

The issue with the get_browser() function in PHP is that it returns an object by default, but sometimes we may need the result as an array instead. To solve this issue, we can use the get_browser(null, true) function call, passing true as the second parameter to get the result as an array. This will return an associative array containing the browser capabilities.

$browserInfo = get_browser(null, true);
print_r($browserInfo);