if(strcmp(substr($_SERVER['SERVER_NAME'], 0, 4), 'wap.') == 0) { echo 'You on wap site'; } else { echo 'You on web site'; }