May 2016
Intermediate to advanced
155 pages
2h 15m
English
© Mikael Olsson 2016
Mikael Olsson, PHP 7 Quick Scripting Reference, 10.1007/978-1-4842-1922-5_31
Mikael Olsson1
(1)Hammarland, Finland
Assert is a debugging feature that can be used during development to ensure that a condition is always true. Any expression can be asserted, as long as it evaluates to either true or false.
// Make sure $myVar is setassert(isset($myVar));
Code assertions like this help validate that there are no execution paths that break the specified assumption. If this occurs, a warning showing the file and line number of the assertion is displayed, which makes it easy to locate and fix the mistake in the code.
Warning: assert(): Assertion failed in C:\xampp\htdocs\mypage.php on line 3A description of the assertion ...
Read now
Unlock full access