You might check your usage of the strstr() function, it may be a simple typo or something. The following works fine for me.
<?php
$s = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.12) Gecko/20070508 Firefox/1.5.0.12";
echo ($found=strstr($s,"Firefox")) ? $found : "(not found)";
echo "<br>Firefox position: ".strpos($s,"Firefox");
echo "<br>Firefox removed..<br>";
$s = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.12) Gecko/20070508 /1.5.0.12";
echo ($found=strstr($s,"Firefox")) ? $found : "(not found)";
echo "<br>Firefox position: ".strpos($s,"Firefox");
?>
preg_match() is always an option if you need more complicated parsing.
Edit: The above was just a knock-up test demo - not my suggestion for code to check browser type
Last edited by Ezzaral; Aug 3rd, 2007 at 6:31 pm.
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 839
Posting Genius
Offline 6,761 posts
since May 2007