I noticed an error which could lead to missing results, and some minor tweaks you could make for greater efficiency; they're small, but it all adds up, especially with PHP.
$agent is loop invariant (never changes) so to be efficient we can move it outside the for() loop and only check it once.
in your case here, instead of !empty($agent) you can simply test $agent.
since you're only testing to see if there is a bot present (and not which/how many), for greater efficiency you can break out of the loop as soon as you find one. Why waste time and cpu cycles once you already have your answer?
Here's the error: if $bot is at the very start of $agent, strpos() will return 0 (zero). The way you test strpos() means that you will miss these cases. To catch them, you must explicitly test strpos() against FALSE.
foreach ($arr as $bot)
if (strpos($bot, $agent) !== FALSE)
$bot_here = true;
Also, if you know which bots visit you the most and you control the mechanism by which $arr is populated, order the array with the most-visited bots listed first; over the long run you'll traverse $arr faster that way.