- explode: documentation ( source)
- preg_grep: documentation ( source)
<?php
$clean_user_agent_test = ' Mozilla/5.0 (Linux; U; Android 4.2; xx-xx; v89_gq2008s Build/JOP40D) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30';
if (empty(preg_grep("/(Mac OS)/", explode("\n", $clean_user_agent_test)))){
print('No');
}
else{
print('Yes');
}