Jayram121 Posted September 6, 2013 Share Posted September 6, 2013 <?php $phoneDevices = array( 'iPhone' => '\biPhone.*Mobile|\biPod', // |\biTunes 'BlackBerry' => 'BlackBerry|\bBB10\b|rim[0-9]+', 'Nexus' => 'Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile', // @todo: Is 'Dell Streak' a tablet or a phone? 'Dell' => 'Dell.*Streak|Dell.*Aero|Dell.*Venue|DELL.*Venue Pro|Dell Flash|Dell Smoke|Dell Mini 3iX|XCD28|XCD35|\b001DL\b|\b101DL\b|\bGS01\b', 'Samsung' => 'Samsung|SGH-I337|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839', 'Sony' => 'SonyST|SonyLT|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i|LT28h|SonyEricssonMT27i', 'Asus' => 'Asus.*Galaxy|PadFone.*Mobile', ); $user_agent = "Mozilla/5.0 (Linux; U; Android 2.3.6; en-gb; GT-S5360 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"; ?> How can I check $user_agent match Associative arrays and print the named keys Quote Link to comment https://forums.phpfreaks.com/topic/281929-matching/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.