|
Posted by Jerry Stuckle on 03/06/07 17:34
Toby A Inkster wrote:
> Jerry Stuckle wrote:
>
>> I agree, Tony.
>
> Jerry, surely we've been posting in the same groups for long enough by now
> for you to have learnt how to spell my name?
>
>> echo statements work quite well.
>
> function debug_them ()
> {
> for ( $i=1 ; $i<func_num_args() ; $i++ )
> {
> $val = func_get_arg($i);
> if (is_array($val))
> print_r($val);
> else
> print $val;
> print "\n----\n";
> }
> if (func_get_arg(0)) exit();
> }
>
> usage:
>
> debug_them(FALSE, $_SESSION, $some_array, $some_var);
> debug_them(TRUE, $_POST);
>
> The first parameter says whether the script should exit after outputting
> the other parameters.
>
Sorry, Toby. Believe it or not - my spell checker "corrected" your name
and I missed it. I've now added your name to the dictionary so it
doesn't happen again :-)
And yes, I use something similar, except I use a class with static
functions and a static variable. If the variable is true it prints the
info.
That way I can say something like:
Debug::setFlag(true);
Debug::dump($var);
Debug::print_r($array);
Turn things on and off with the setFlag member. And a file quick search
on Debug:: will find the references to delete them. Or I can just
create a dummy debug class which does nothing (and therefore has very
little overhead).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|