- preg_match: documentation ( source)
- implode: documentation ( source)
- explode: documentation ( source)
<?php
$HTTP_USER_AGENT = "test2";
$seoagents = "test1,test2,test3";
$custom1agents = explode(",",$seoagents);
//echo implode('|', $custom1agents);
if(preg_match('/('.implode('|', $custom1agents).')/i', $HTTP_USER_AGENT, $match))
{
echo "matched";
}
else
{
echo "did not match";
}