note 20836 rejected from function.eregi by torben

From: Date: Wed, 17 Apr 2002 21:03:33 +0000
Subject: note 20836 rejected from function.eregi by torben
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-29503@lists.php.net to get a copy of this message
I want to get OS and it's version out of $HTTP_USER_AGENT if(eregi("windows nt [0-9]{1,2}.[0-9]{1,2}",$HTTP_USER_AGENT,$match)) { $os = $match["1"]; $version = $match["2"]; } This code i IMO pretty nice, but there are some bugs: how do i make difference of which matches match[1] and which matches match[2] ?!? PS, I got the idea from a post (kavandi@alias.net.au) in get_browser section (http://www.php.net/manual/en/function.get-browser.php). Can someone explain it to me?

« previous php.notes (#29503) next »