3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $_SERVER["HTTP_USER_AGENT"] = "TeachMe-App v000003 iOS 7 on generic"; $Client = array(); $Client["Client"] = substr($_SERVER["HTTP_USER_AGENT"], 0, strpos($_SERVER["HTTP_USER_AGENT"], "v")-1) or die(); $Client["OS"] = substr($_SERVER["HTTP_USER_AGENT"], strpos($_SERVER["HTTP_USER_AGENT"], "v")+7, strpos($_SERVER["HTTP_USER_AGENT"], "on") - strpos($_SERVER["HTTP_USER_AGENT"], "v", 0)); $Client["Device"] = substr($_SERVER["HTTP_USER_AGENT"], strpos($_SERVER["HTTP_USER_AGENT"], "on") + 3); $Client["Version"] = substr($_SERVER["HTTP_USER_AGENT"], strpos($_SERVER["HTTP_USER_AGENT"], "v") + 1, 6); print_r($Client);
based on l2Xj8
Output for 4.3.0 - 7.1.0
Array ( [Client] => TeachMe-App [OS] => iOS 7 on gene [Device] => generic [Version] => 000003 )