Re: preg_match error

From: Date: Thu, 15 Jun 2000 13:45:31 +0000
Subject: Re: preg_match error
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-476@lists.php.net to get a copy of this message
> <?php > $browser_type = getenv("http_user_agent"); > if (preg_match("/MSIE/i", "$browser_type")) { > echo "Using Microsoft Internet Explorer."; > } else if (preg_match("/Mozilla/i", "$browser_type")) { > echo "Using Netscape Communicator."; > } else { > echo "$browser_type"; > } > > ?> > Use the following line just before IF statement: dl ("php3_pcre.dll"); This loads a PCRE library so you can use preg_ functions. Or else, you can rewrite it like this: if (eregi ("MSIE", $browser_type)) { ... ereg functions are built-in. See manual for Regular Expressions. -- Stas Trefilov Moscow Russia

« previous php.windows (#476) next »