I am new to using PHP and am learning it by reading the documentation on php.net- currently the page for assert() to know about those assert()
The assert() function is a good way to ensure certain conditions are true throughout the life of your code. To quote this article by Paul Hudson:
Essentially, assert() is used to say "This statement must be true - if it isn't, please tell me".
To enable assertion handling, use assert_options(ASSERT_ACTIVE)
, and also use assert_options() with other arguments to control what happens when assertions fail (e.g. ending the PHP script execution when an assertion fails, calling a handler function- which could be used to send emails, log data in files and/or database tables, etc.). Refer to the parameters section for the list of all options and their outcomes.
Try out some of the options in this playground example.
Read that article for more information about both of those functions.