Over 100 Functions call alone for isMobile() for a preg_match itś only have ja return true|false; and a preg syntak value1|value|value3|value4 and a array with all mobile checks or tablet or device checks idk . 

implode('|',$array('isApple'=>'test1|test2|test3'),'isSamsung'=>'test7|test8|test9')) also = test1|test2|test3|test7|test8|test9 in this routine 
same return true but no 138 calls + preg_match call (time) checks by a desktop

implode is the simpelst way to speed up the large function you can define $imp like false it a other code style but the same effect
-----
you can also make foreach by this function but then cache the preg_match. It is a horrible Performance call this 2 ,3 ,4 for times out ignorance and save the key for speed up the match UAAgent you have this one