Posted by Richard Cornford on 02/18/07 13:04
Kimmo Laine wrote:
> chadlupkes kirjoitti:
<snip>
>> str = trim(str);
>
> Trims whitespace from the input
Assuming a congaing scope defines a function called - trim - and trimming
white space is what that function does (likely but not certain).
>> <?if(preg_match("/MSIE 5.0;/", $_SERVER['HTTP_USER_AGENT']))
>> // this is IE 5.0
>> {?>
>
> Enter php. If the useragent is IE 5 it prints this block of js:
Not 'if the user agent is' but 'if the user agent header contains the
character sequence'.
<snip>
> A complete rewrite couldn't make it worse.
It is irrational as it is.
> I find it difficult to believe that the javascript engines on
> different browsers would be so horribly iincomptaible that you'd
> need to write a separate regexp for it,
They re not. The standard for the language provides a minimum syntax for
regular expressions, and then allows implementations to extend it. You
achieve cross-browser compatibility by using the specified syntax and
keep the extensions for use only when you know the browser environment
with certainty. (that just leaves one or two very minor bugs to be
avoided).
> but then again with IE nothing suprises me.
In this context any fault to be attributed goes to the author of the
code. IE is innocent here.
Richard.
[Back to original message]
|