Double check if you can get away with a simple if(strtolower($server_request) == $ajax_request) {...}

Also you can make code smaller by doing the following:
return (!empty($server_request) && strtolower($server_request) == $ajax_request);