well i wrote a code that I want to detect browser and I've an idea that check the values with array but my problem is that loop doesn't work very well i mean the loop else always show the else results.this is my code :
$name=strtolower($_SERVER ['HTTP_USER_AGENT']);
$browsers=array("firefox","chrome","opr" );
for each($browsers as $key){
$key=$key;
$s=strpos($name,$key);
if($s){
echo $key;
}
else
if(!$s) {
echo "Not found!";
}
well the result in Mozila browser is Firefox but in chrome the result is " Not found!chromeNot found!" what should I do if I don't want show those not founds.thanks.
Aucun commentaire:
Enregistrer un commentaire