Skip to content

Instantly share code, notes, and snippets.

@hassanjamal
Created September 14, 2013 07:18
Show Gist options
  • Save hassanjamal/6559583 to your computer and use it in GitHub Desktop.
Save hassanjamal/6559583 to your computer and use it in GitHub Desktop.
<?php
$browsers = array('firefox','chrome','safari','opera','msie');
$browser = new stdClass();
preg_match('#('.implode('|',$browsers).')(/| )([^ ]+)#i',$_SERVER['HTTP_USER_AGENT'],$match);
$browser->version = round((int)$match[3]);
$match = strtolower($match[1]);
foreach($browsers as $val)
{
$browser->{$val} = ($match == $val ? TRUE : FALSE);
}
if($browser->safari || $browser->opera)
{
preg_match('#version/([^ ]+)#i',$_SERVER['HTTP_USER_AGENT'],$match);
$browser->version = round((int)$match[1]);
}
$browser->webkit = ($browser->chrome || $browser->safari ? TRUE : FALSE);
var_dump($browser);
?>
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.0.*",
"way/generators": "1.0.*@dev",
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment