A Function to Format Debugging Messages : Debug : Development PHP Source Code


PHP Source Code » Development » Debug »

 

A Function to Format Debugging Messages




<?php
function debug$line, $msg ){
    static $calls = 1;
    print "<P><HR><br>n";
    print "DEBUG $calls: Line $line: $msg<br>";
    $args = func_get_args();
    
    if (  count$args )
        print "Odd number of args<BR>";
    else{
        for $x=2; $x< count($args); $x += ){
            print "&nbsp&nbsp; $$args[$x]: ".$args[$x+1];
            print " .... (".gettype$args[$x+1] ).")<BR>n";
        }
    }
    print "<hr><p></p>n";
    $calls++;
}

$test = 55;
debug__LINE__, "First message""test", $test );

$test = 66;
$test2 = $test/2;
debug__LINE__, "Second message""test", $test, "test2", $test2 );
?>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Development
» Debug