assert

(PHP 4 >= 4.0b4)

assert -- Checks if assertion is false

Description

int assert (string|bool assertion)

assert() will check the given assertion and take appropriate action if its result is false.

If the assertion is given as a string it will be evaluated as PHP code by assert(). The advantages of a string assertion are less overhead when assertion checking is off and messages containing the assertion expression when an assertion failes.

Assertion should be used as a debugging feature only. You may use them for sanity-checks that test for conditions that should always be true and that indicate some programming errors if not or to check for the presence of certain features like extension functions or certain system limits and features.

Assertions should not be used for normal runtime operations like input parameter checks. As a rule of thumb your code should always be able to work correct if assertion checking is not activated.

The behavior of assert() may be configured by assert_options() or by .ini-settings described in that functions manual page.


HIVE: All information for read only. Please respect copyright!
Hosted by hive КГБ: Киевская городская библиотека