3v4l.org

run code in 300+ PHP versions simultaneously
<?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 git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key "HTTP_USER_AGENT" in /in/hIP3g on line 8 Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /in/hIP3g on line 10 Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /in/hIP3g on line 12 Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /in/hIP3g on line 14 Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /in/hIP3g on line 16 Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /in/hIP3g on line 18 Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /in/hIP3g on line 20 Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /in/hIP3g on line 22 Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /in/hIP3g on line 24

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
39.56 ms | 403 KiB | 8 Q