Hi Morgan,

You tip is fantastic. Will post it (with your permission) at my weblog,
http://php.weblogs.com/ tomorrow.

Regards, John

"Morgan Curley" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I generally include the following function:
>          function dump( $label, $input ){
>                  echo( "<PRE>" );
>                  echo( "<H2>$label</H2>\n" );
>                  print_r( $input );
>                  echo( "</PRE>" );
>                  return 1;
>          }
>
> or if you like javascript this pops up an alert wherever you insert the
> dump call in your page
>          function dump( $label, $input ){
>                  ob_start();
>                  print_r( $input );
>                  $gc     = ob_get_contents();
>                  ob_end_clean();
>
>                  $gc = preg_replace( "/'/", "\\'", $gc );
>                  $gc = preg_replace( '/\n/', '\\n', $gc );
>                  echo( "<script>alert( '$label\\n".$gc."' );</script>" );
>                  return 1;
>          }
>
> then for simple debugging I call
> dump( "My Label", $my_var );
>
> With the javascript you can do some cool things like having divs generated
> per $label.
>
> morgan
>
>
>
> At 02:26 PM 4/9/2001, you wrote:
> >Just a question that has been besetting me for a while:
> >
> >which is better for debugging -- vardump( ) or print( ) ?
> >
> >Does anyone have a preference? Why? Is one better than the other?
> >Thanks for answering this prickly question!
> >
> >John Lim
> >
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to