assert_options(ASSERT_WARNING, 0);
assert_options(ASSERT_QUIET_EVAL, 1);
// handler function
function assert_handler($file, $line, $code, $desc = null)
{
echo "Assertion failed at $file:$line: $code";
if ($desc)
echo ": $desc" . "<br />";
echo "<br />";
}
// Set up the callback handler function
assert_options(ASSERT_CALLBACK, 'assert_handler');
// Make failed assertion
assert('2 < 1');
assert('2 < 1', '2 is > than 1');
/*
run:
Assertion failed at C:\xampp\htdocs\knowrex.com\test.php:26: 2 < 1
Assertion failed at C:\xampp\htdocs\knowrex.com\test.php:27: 2 < 1: 2 is > than 1
*/
?>