note 79282 deleted from function.get-browser by cmb
| From: | cmb@php.net | Date: | Sun, 23 Feb 2020 08:56:29 +0000 |
| Subject: | note 79282 deleted from function.get-browser by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-214195@lists.php.net to get a copy of this message | ||
Note Submitter: jesdisciple [at] gmail -dawt- com
----
Use this to ensure that the costly call in its standard form never needs to be repeated:
<?php
function getBrowser(){
static $browser;//No accident can arise from depending on an unset variable.
if(!isset($browser)){
$browser = get_browser($_SERVER['HTTP_USER_AGENT']);
}
return $browser;
}
?>