How to Detect Internet Explorer with PHP

Detect IE with PHP

function ae_detect_ie()
{
if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false))
return true;
else
return false;
}

// Use the function and create a condition

if(ae_detect_ie() == true){

echo "You're using IE";

}else{

echo "I'm glad you're not using IE";
}

About Rick

Senior Front-end Software Engineer from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.
2 comments

Leave a Reply

Add <code> Some Code </code> by using this tags.

*
*