I cannot seem to figure out how to make changes to a couple scripts for controlling which css to display - based on browser type. I'm trying to include an if statement for android mobile devices, but the page continues to jump to the last default 'else' statement.

I have the first script here:
PHP Code:
<?php
    $iphone_test 
strstr(css_browser_selector(),"iphone");
    
$ipad_test strstr(css_browser_selector(),"ipad");

    
    if(
$iphone_test == true || $ipad_test == true)
    {
        
$mobile_active true;
    }
    else
    {
        
$mobile_active false;
    }
    
    
$ie9_test strstr(css_browser_selector(),"ie9");
    
$ie10_test strstr(css_browser_selector(),"ie10");
    
    if(
$ie9_test == true || $ie10_test == true)
    {
        
$ieX_active true;
    }
    else
    {
        
$ieX_active false;
    }
    
    if(
strstr(css_browser_selector(),"webkit") == true && $mobile_active == false && strstr(css_browser_selector(),"chrome") == false){
        
?>
        <link rel="stylesheet" media="screen" type="text/css" href="<?php echo ('css/safari.css'?>" />
        <?php  // safari appears fine here.
    
}
    else if(
strstr(css_browser_selector(),"iphone") == true){
        
?>
        <link rel="stylesheet" media="screen" type="text/css" href="<?php echo ('css/iphone.css')?>" />
        <?php
    
}
    else if(
strstr(css_browser_selector(),"ipad") == true){
        
?>
        <link rel="stylesheet" media="screen" type="text/css" href="<?php echo ('css/ipad.css')?>" />
        <?php
    
}
    else if(
strstr(css_browser_selector(),"chrome") == true && strstr(css_browser_selector(),"win") == true){
        
?>
        <link rel="stylesheet" media="screen" type="text/css" href="<?php echo ('css/chrome.css')?>" />
        <?php 
    
}
    else if(
strstr(css_browser_selector(),"mozilla") == true && strstr(css_browser_selector(),"win") == true){
        
?>
        <link rel="stylesheet" media="screen" type="text/css" href="<?php echo ('css/chrome.css')?>" />
        <?php echo "moz ";
    }
    else if(
strstr(css_browser_selector(),"android mobile") == true){
        
?>
        <link rel="stylesheet" media="screen" type="text/css" href="<?php echo ('css/chrome.css')?>" />
        <?php echo "test mobile";
    }
    else if(
strstr(css_browser_selector(),"android tablet") == true){
        
?>
        <link rel="stylesheet" media="screen" type="text/css" href="<?php echo ('css/chrome.css')?>" />
        <?php echo "test tablet";
    }
    else if(
strstr(css_browser_selector(),"ie") == true && $ieX_active == false){
        
?>
        <link rel="stylesheet" media="screen" type="text/css" href="<?php echo ('css/ie.css')?>" />
        <?php
    
}
    else if(
$ieX_active == true){
        
?>
        <link rel="stylesheet" media="screen" type="text/css" href="<?php echo ('css/ieX.css')?>" />
        <?php
    
}
    else
    {
        
?>
        <link rel="stylesheet" media="screen" type="text/css" href="<?php echo ('css/gecko.css')?>" />
        <?php echo "test2";
    }
 
?>
The second script is this. I've added in a couple if statements for android and mobile/tablet. but no luck.

PHP Code:
function css_browser_selector($ua=null) {
        
$ua = ($ua) ? strtolower($ua) : strtolower($_SERVER['HTTP_USER_AGENT']);        

        
$g 'gecko';
        
$w 'webkit';
        
$s 'safari';
        
$a_m 'android mobile';
        
$a_t 'android tablet';
        
$b = array();
        
        
        
// browser
        
if(!preg_match('/opera|webtv/i'$ua) && preg_match('/msie\s(\d)/'$ua$array)) {
                
$b[] = 'ie ie' $array[1];
        }    else if(
strstr($ua'firefox/2')) {
                
$b[] = $g ' ff2';        
        }    else if(
strstr($ua'firefox/3.5')) {
                
$b[] = $g ' ff3 ff3_5';
        }    else if(
strstr($ua'firefox/3')) {
                
$b[] = $g ' ff3';
        } else if(
strstr($ua'gecko/') && !strstr($ua'mobile')) {
                
$b[] = $g;
        } else if(
preg_match('/opera(\s|\/)(\d+)/'$ua$array)) {
                
$b[] = 'opera opera' $array[2];
        } else if(
strstr($ua'konqueror')) {
                
$b[] = 'konqueror';
        } else if(
strstr($ua'chrome')) {
                
$b[] = $w ' ' $s ' chrome';
        } else if(
strstr($ua'iron')) {
                
$b[] = $w ' ' $s ' iron';
        } else if(
strstr($ua'applewebkit/')) {
                
$b[] = (preg_match('/version\/(\d+)/i'$ua$array)) ? $w ' ' $s ' ' $s $array[1] : $w ' ' $s;
        } else if(
strstr($ua'mozilla/')) {
                
$b[] = $g;
        } else if(
strstr($ua'android;') && strstr($ua'mobile')) { // check if android mobile
                
$b[] = $a_m;
        } else if(
strstr($ua'android;') && !strstr($ua'mobile')) { // check if android tablet
                
$b[] = $a_t;
        }

        
// platform                
        
if(strstr($ua'j2me')) {
                
$b[] = 'mobile';
        } else if(
strstr($ua'iphone')) {
                
$b[] = 'iphone';        
        } else if(
strstr($ua'ipad')) {
                
$b[] = 'ipad';        
        } else if(
strstr($ua'ipod')) {
                
$b[] = 'ipod';        
        } else if(
strstr($ua'mac')) {
                
$b[] = 'mac';        
        } else if(
strstr($ua'darwin')) {
                
$b[] = 'mac';        
        } else if(
strstr($ua'webtv')) {
                
$b[] = 'webtv';        
        } else if(
strstr($ua'win')) {
                
$b[] = 'win';        
        } else if(
strstr($ua'freebsd')) {
                
$b[] = 'freebsd';        
        } else if(
strstr($ua'x11') || strstr($ua'linux')) {
                
$b[] = 'linux';        
        }
                
        return 
join(' '$b);
        
}

?>