assert

bool assert (mixed assertion) 

Checks whether an assertion is false.

Returns:

FALSE if assertion fails

Description:

This is similar to the C function of the same name. A piece of code is evaluated by the function; if FALSE is returned from the function, a warning is generated indicating the file and line number where the assertion failed. This function should only be used to debug code or return values from functions.

You can modify the output and behavior of this function by using the assert_options() function or by modifying the php.ini file.

assert() callbacks are particularly useful for building automated test suites because they allow you to easily capture the code passed to the assertion, along with information on where the assertion ...

Get PHP Functions Essential Reference 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.