Post

Browser.php - version 1.1 - released!

I updated the Browser.php class today to detect Google’s Chrome Browser. Additionally, thanks to an idea from Daniel ‘mavrick’ Lang, I added isBrowser($browserName) as a function to version 1.1.

Visit the Browser.php class page today to grab the update!

Interested in a PHP4 version? Daniel is maintaining a version for PHP4.

Example Usage:

1
2
3
4
5
6

$browser = new Browser();
if( ! ( $browser->getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 2 ) ) {
	echo 'You have FireFox version 2 or greater';
}

// AND NOW…

1
2
3
if( $browser->isBrowser(Browser::BROWSER_CHROME) ) {
	echo '<p><strong>Hi Google Chrome User!</strong></p>';
}
This post is licensed under CC BY 4.0 by the author.