9.4. Debugging

The debugging functions help you figure out just what is going on with the inevitable broken script. Some of these functions make diagnostic information available to you inside your script. Others communicate with either a system log or a remote debugger. Practical approaches to debugging are addressed in Chapter 28.

assert(boolean expression)assert(string expression)

The assert function (Listing 9.59) tests an expression. If the assertion is TRUE, no action is taken and the script continues. If the assertion is FALSE, behavior is dictated by the assertion options. By default, assertions are not active, which means they are simply ignored. Use assert_options to activate them.

Assertions are a nice way to add error checking to your ...

Get Core PHP Programming, 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.