note 20836 added to function.eregi
| From: | magnus at v-maarja dot ee | Date: | Wed, 17 Apr 2002 20:48:48 +0000 |
| Subject: | note 20836 added to function.eregi | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29502@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?
--
http://www.php.net/manual/en/function.eregi.php
http://master.php.net/manage/user-notes.php?action=edit+20836
http://master.php.net/manage/user-notes.php?action=delete+20836
http://master.php.net/manage/user-notes.php?action=reject+20836