Debugging

The debugging functions help you figure out just what the heck 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 21, "Design."

assert(expression)

The assert function 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 code, especially paranoid checks ...

Get Core PHP Programming: Using PHP to Build Dynamic Web Sites 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.