note 51164 added to function.get-browser
| From: | fjocke at hotmail dot com | Date: | Tue, 22 Mar 2005 13:34:40 +0000 |
| Subject: | note 51164 added to function.get-browser | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-86779@lists.php.net to get a copy of this message | ||
<?PHP
//Created by joakim forslund 2005
//You may use this script exactly how you want aslong as you keep this notice in the top of the
code!
//Show what browser and what verision you are running
$Browser = $_SERVER['HTTP_USER_AGENT']; // Gets the information header
$Browser = strtolower($Browser); // Makes everything into lowercase
$browser_exp = explode(" ", $Browser);
//Since the returned line has " " space between every single diffrent information topic it
makes it easy to create an array and pick out what browser it is
$browser_exp = array_reverse($browser_exp);// Makes the Array reversed so you only need to pick the
first alternative
$tmp = $browser_exp[0]; //Binds tmp too the browser name and the version
$string_exp = explode("/", $tmp); // Since its a "/" between the browser name
and version we need to explode that aswell.
echo "Browser: ".$string_exp[0]."<BR>"; // Gives the browser name
echo "Version: ".$string_exp[1]."<BR>"; // Gives teh browser version
?>
----
Manual Page -- http://www.php.net/manual/en/function.get-browser.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51164
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51164&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51164&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51164&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51164&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51164&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51164&report=yes
Search -- http://master.php.net/manage/user-notes.php