> How do i extract the position (integer counting from the left)
> of the letter M (beginning 'MSIE'.
> $str = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
This should do it :
<?php
$str = 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)';
print strpos($str,'MSIE'); // prints position of M (25).
print $str[strpos($str,'MSIE')]; // prints M
print $str[25]; // prints M
?>
An article that uses regular expressions to deal with this browser
detection hoopla can be seen here :
http://phpbuilder.com/columns/tim20000821.php3
Be sure to check the user comments too.
Regards,
Philip
On Wed, 28 Mar 2001, Costas wrote:
> How do i extract the position (integer counting from the left) of the letter
> M (beginning 'MSIE'.
>
> $str = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
>
> NOTE, i only want a single integer (it is 28, i counted manuallt!!)
>
> Thanks
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]