What is PhpDig?
PhpDig is a PHP MySQL based
Web Spider & Search Engine.



get_browser — Gets information on a browser's features.


mixed get_browser([user_agent]);
user_agent (optional): Name of an HTTP user agent


Object containing the browser's properties; FALSE on error


get_browser() is used to match an HTTP User Agent header to an entry in a browscap.ini file. browscap.inifiles contain information on browser capabilities, such as whether they support JavaScript, whether they have the ability to display frames, and so on.

The optional user_agent argument allows developers to specify the HTTP user agent to use for the capabilities lookup. If no user_agent argument is specified, PHP uses the value of $HTTP_USER_AGENT for the user_agent argument.

The browser capability information is returned as an object containing a variable number of properties that represent browser capabilities.

For more information on the format of the browscap.ini, visit and search for "Browser Capabilities Component browscap.ini."

The location of the browscap.ini file must be specified in the php.ini file. Additionally, the browscap.ini file should be regularly updated to remain effective - visit to get the latest update.


With recent versions of the browscap.ini file, if an HTTP User Agent header doesn't match any of the HTTP User Agent header values in the file, a generic and limited set of browser capabilities is returned.


PHP Version: 3+, 4+


Example 755. Show all the properties of the current browser

foreach ((array) get_browser () as $key => $value) {
    printf ("%-'.24s.%s\n", $key, $value);

Example 756. Display different information if the client is a web crawler/robot

$browscap = get_browser ();

if (TRUE == $browscap['crawler']) {
    include ('crawler.php');

PHP Functions Essential Reference. Copyright © 2002 by New Riders Publishing (Authors: Zak Greant, Graeme Merrall, Torben Wilson, Brett Michlitsch). This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at The authors of this book have elected not to choose any options under the OPL. This online book was obtained from and is designed to provide information about the PHP programming language, focusing on PHP version 4.0.4 for the most part. The information is provided on an as-is basis, and no warranty or fitness is implied. All persons and entities shall have neither liability nor responsibility to any person or entity with respect to any loss or damage arising from the information contained in this book.

Powered by: vBulletin Version 3.0.7
Copyright ©2000 - 2005, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.