Chapter 23. Other Useful Features

Some useful PHP functions and features do not fit into any particular category. This chapter explains these features.

Key topics covered in this chapter include

  • Using magic quotes

  • Evaluating strings with eval()

  • Terminating execution with die and exit

  • Serializing variables and objects

  • Getting information about the PHP environment

  • Temporarily altering the runtime environment

  • Loading PHP extensions

  • Highlighting source code

  • Using PHP on the command line

Using Magic Quotes

You have probably noticed that you need to be careful when using quotation marks (' and ") and back slashes (\) within strings. PHP gets confused by an attempted string statement like

echo "color = "#FFFFFF"";

and gives a parse error. To include quotation marks ...

Get PHP and MySQL Web Development, Third 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.