3v4l.org

run code in 300+ PHP versions simultaneously
<?php function is_wptouch_user_agent() { // This needs to match your WP Touch list!! $useragents = array( "iphone", // Apple iPhone "ipod", // Apple iPod touch "aspen", // iPhone simulator "dream", // Pre 1.5 Android "android", // 1.5+ Android "cupcake", // 1.5+ Android "blackberry9500", // Storm "blackberry9530", // Storm "opera mini", // Experimental "webos", // Experimental "incognito", // Other iPhone browser "webmate" // Other iPhone browser ); $browser_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:16.0) Gecko/20100101 Firefox/16.0"; $is_wptouch_ua = false; foreach ( $useragents as $useragent ) { if ( preg_match( "#$useragent#i", $browser_agent ) ) { $is_wptouch_ua = true; break; } } return($is_wptouch_ua); } global $batcache; $batcache->unique['wptouch'] = is_wptouch_user_agent(); echo $batcache->unique['wptouch'];
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Attempt to modify property "unique" on null in /in/GrNu0:32 Stack trace: #0 {main} thrown in /in/GrNu0 on line 32
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Creating default object from empty value in /in/GrNu0 on line 32
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.5 - 7.2.33, 7.3.12 - 7.3.33

preferences:
267.84 ms | 405 KiB | 352 Q