Browser Detection in PHP
//// Apply condtion for further Uses..../////
- <?php
- $ie = strpos($_SERVER["HTTP_USER_AGENT"], 'IE') ? true : false;
- $M_firefox = strpos($_SERVER["HTTP_USER_AGENT"], 'Firefox') ? true : false;
- $safari = strpos($_SERVER["HTTP_USER_AGENT"], 'Safari') ? true : false;
- $G_chrome = strpos($_SERVER["HTTP_USER_AGENT"], 'Chrome') ? true : false;
- ?>
If you like it , then don't forgot to share it!
- <?php
- //Firefox
- if ($M_firefox) {
- echo 'you are using Firefox!';
- echo '<br />';
- }
- // Both(Safari or Chrome) use the same engine - webkit
- if ($safari || $G_chrome) {
- echo 'your browser is a webkit powered browser(Chrome Or Safari)';
- echo '<br />';
- }
- // IE
- if ($ie) {
- echo '<br>your browser is Internet Explorer<br>';
- echo '<br />';
- }
- // Not IE and for all other browsers
- if (!$ie) {
- echo '<br>your browser is not Internet Explorer<br>';
- echo '<br />';
- }
- ?>