/ Published in: PHP

This is a useful debugging utility in lieu of Exception objects
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?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. */ 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; } } ?>
Comments
