Revision: 5374
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 4, 2008 21:23 by phifty
Initial Code
<?php
// FILE: assertion.php
// DESCRIPTION: Handles assertions where the Exception object is not used
// ---------------------------------
// Mon Mar 03 21:36:54 EST 2008
/**
* USAGE:
* assert(string code)
* The code should be passed as a string similar to the way eval() is invoked.
*/
assert_options(ASSERT_CALLBACK, 'assertion_handler');
assert_options(ASSERT_ACTIVE, 1);
assert_options(ASSERT_WARNING, 0);
assert_options(ASSERT_QUIET_EVAL, 1);
function assertion_handler($file, $line, $code)
{
if (true === DEBUG_MODE) {
$msg = <<<EOT
<pre style="background-color:#FF0000;color:#FFFFFF;font-weight:bold;padding:8px;">
FAILED ASSERTION
File: {$file}
Line: {$line}
Code: {$code}
</pre>
EOT;
print $msg;
}
}
?>
Initial URL
Initial Description
This is a useful debugging utility in lieu of Exception objects
Initial Title
Simple assertion handler
Initial Tags
Initial Language
PHP