O'Reilly logo

Core PHP Programming: Using PHP to Build Dynamic Web Sites by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Cloaking

When creating a plain HTML site, you confront two paths: create a site that works great in only one browser, or create a mediocre site that works in all browsers. PHP allows you to create a site that works great in any browser. The HTTP_USER_AGENT variable contains the string most browsers send to the Web server to identify themselves. This variable may be used to choose between versions of content. This cloaks the inner workings of the site from the browser. A seamless experience is provided to visitors, despite differences in browser capabilities.

Chapter 16, "Parsing and String Evaluation," contains an example of using regular expressions to parse HTTP_USER_AGENT into understandable elements. In most cases browser name and version ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required