Support » Plugin: PHP Browser Detection » overall memory improvement

  • Resolved majick

    (@majick)


    I just noticed that php_browser_info calls $browscap->getBrowser every time, and thus so do all the child functions which use it (basically all of them), which depending on how many times they are used could chew up a lot of memory. so my suggestion is use a global variable for it and call getBrowser once… I think this would do the trick (untested):

    function php_browser_info() {
    	global $browscapinfo;
            if ($browscapinfo == '') {
                global $browscap;
    	    $browscapinfo = $browscap->getBrowser(NULL, TRUE);
            }
            return $browscapinfo;
    }

    https://wordpress.org/plugins/php-browser-detection/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘overall memory improvement’ is closed to new replies.