How to Detect Internet Explorer with PHP

Detect IE (Internet Explorer) with this PHP snippet. It checks the User Agent.

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";
}
2 comments

Leave a Reply

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

*
*