Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 15th, 2004, 04:30 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh, crap! What a friggin headache!

I guess I would still minimize the number of calls and try to work out a regex solution. Something like:

if (preg_match('!Opera[/ ]?(\d*)!', $agent, $matches)) // opera. Version is in $matches[1]
{
   ...
}
else if (preg_match('!MSIE[/ ]?(\d*)!', $agent, $matches)) //IE. Version is in $matches[1]
{
}
else if (preg_match('!Mozilla[/ ]?(\d*)!', $agent, $matches)) // You get the idea
{
}
else // None of the above -- "safe"
{
}


Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript+netscape sasidhar79 Javascript How-To 1 October 19th, 2004 05:52 AM
Netscape stu9820 HTML Code Clinic 24 May 19th, 2004 01:56 AM
Netscape and activex cirudinezidane Javascript How-To 1 March 11th, 2004 04:34 AM
CSS in Netscape cjo XML 4 October 26th, 2003 05:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.