I need to check my script for a user agent for mobile devices.
I have
if(preg_match('/lg|iphone|blackberry|opera/i', $_SERVER['HTTP_USER_AGENT'])) { ... }
I recognized lg , you need to be the first part of the line
eg:
lg-9000 ... lg1000 ... lg 2000 ... lge4300 ...
Basically, I want to know if it is possible to find a string (from my regular expression) in the user agent, starting from the beginning, and not somewhere in the string.
I would not want to change the regex string
thanks
source share