Location: PHPKode > scripts > Request Info User Agent > request-info-user-agent/test/_data/syntheseFunction.php
<?php
require_once dirname(__FILE__) . '/../UserAgent.php';

function systemsStats() {
    FredT_Request_Info_UserAgent::setDetectMode(FredT_Request_Info_UserAgent::MODE_FULL_DETECT);
    $_infoUA = new FredT_Request_Info_UserAgent();
    $_oSXE = @simplexml_load_file(dirname(__FILE__) . '/UA.xml');
    $aTest=array();
    foreach ($_oSXE as $val) {
        $_infoUA->setUserAgent((string) $val->navigateur);
        $type=$_infoUA->getSystemType();
        if ( ! isset($aTest[$type])) {
        	$aTest[$type]=array();
        }
        $name=$_infoUA->getSystem();
        if ( ! isset($aTest[$type][$name])) {
        	$aTest[$type][$name]=array();
        }
        $version=$_infoUA->getSystemVersion();
        if ( ! isset($aTest[$type][$name][$version])) {
        	$aTest[$type][$name][$version]=0;
        }
        $aTest[$type][$name][$version]+=$val->nb;
    }
    //var_dump($aTest);
    return $aTest;
}

function systemsWinLin() {
    FredT_Request_Info_UserAgent::setDetectMode(FredT_Request_Info_UserAgent::MODE_FULL_DETECT);
    $_infoUA = new FredT_Request_Info_UserAgent();
    $_oSXE = @simplexml_load_file(dirname(__FILE__) . '/UA.xml');
    $aTest=array();
    foreach ($_oSXE as $val) {
        $_infoUA->setUserAgent((string) $val->navigateur);
        $system=$_infoUA->getSystem();
        if ($system=='Windows' || $system=='Linux') {
            if ( ! isset($aTest[$system])) {
            	$aTest[$system]=array();
            }
            $version=$_infoUA->getSystemVersion();
            if ( ! isset($aTest[$system][$version])) {
            	$aTest[$system][$version]= array();
            }
            $aTest[$system][$version][]=$_infoUA->getUserAgent();
        }
    }
    return $aTest;
}

//var_dump(systemsWinLin());
//var_dump(systemsStats());
Return current item: Request Info User Agent