Hey.
Your use of the
$HTTP_USER_AGENT is most likely not going to work on 5.3
(or any version after 4.2). You should be using
$_SERVER['HTTP_USER_AGENT'] instead.
This is because of the
register_globals directive, which was used in the past to extract all $_REQUEST, $_COOKIE and $_SERVER variables into the global scope. This has been deprecated since 4.2, and will be removed in 6.0, so it is best to not rely on it.
As to your regexp, these two if blocks produce the same results in 5.3:
(Tested them in Opera 10.10... which oddly enough identifies itself as Opera 9.80...) - if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'], $matches)) {
-
var_dump($matches);
-
}
-
-
if (preg_match('#Opera(/| )([0-9]\.[0-9]{1,2})#i', $_SERVER['HTTP_USER_AGENT'], $matches)) {
-
var_dump($matches);
-
}
The
PCRE (preg) pattern is a little different, but not so much that it should be hard to convert old POSIX
(ereg) expressions. Just takes a bit of Googling :)