3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function getUserAgent() { $agent = null; if ( empty($agent) ) { $agent = $_SERVER['HTTP_USER_AGENT']; if ( stripos($agent, 'Firefox') !== false ) { $agent = 'firefox'; } elseif ( stripos($agent, 'MSIE') !== false ) { $agent = 'ie'; } elseif ( stripos($agent, 'iPad') !== false ) { $agent = 'ipad'; } elseif ( stripos($agent, 'Android') !== false ) { $agent = 'android'; } elseif ( stripos($agent, 'Chrome') !== false ) { $agent = 'chrome'; } elseif ( stripos($agent, 'Safari') !== false ) { $agent = 'safari'; } elseif ( stripos($agent, 'AIR') !== false ) { $agent = 'air'; } elseif ( stripos($agent, 'Fluid') !== false ) { $agent = 'fluid'; } } return $agent; } echo getUserAgent(); ?>
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Undefined index: HTTP_USER_AGENT in /in/hIP3g on line 8
Output for 5.0.0 - 5.2.17
Notice: Undefined index: HTTP_USER_AGENT in /in/hIP3g on line 8
Output for 4.4.5 - 4.4.9
Notice: Undefined index: HTTP_USER_AGENT in /in/hIP3g on line 8 Fatal error: Call to undefined function: stripos() in /in/hIP3g on line 10
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Notice: Undefined index: HTTP_USER_AGENT in /in/hIP3g on line 8 Fatal error: Call to undefined function: stripos() in /in/hIP3g on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Undefined index: HTTP_USER_AGENT in /in/hIP3g on line 8 Fatal error: Call to undefined function: stripos() in /in/hIP3g on line 10