© Frank M. Kromann 2016

Frank M. Kromann, PHP and MySQL Recipes, 10.1007/978-1-4842-0605-8_9

9. Regular Expressions

Frank M. Kromann

(1)Trabuco Canyon, California, USA

PHP is often described as a templating language where HTML sections and script are mixed to generate HTML documents for rendering in a browser. As the web technology is advancing PHP is used to generate other types of content (JSON, see chapter 14; and images see chapter 8, etc.) and the PHP scripts contain less embedded HTML sections. Instead the script will read a template from disk or a database and perform string replacements on the content before sending it to the client.

Simple string replacements can be done with the str_replace() function , but this function will replace a ...

Get PHP and MySQL Recipes: A Problem-Solution Approach, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.