PHP - Print Debug Information


/ Published in: PHP
Save to your folder(s)

Print Debug Information (Exibe as informações de depuração)


Copy this code and paste it in your HTML
  1. function pdbg($data, $color="orange", $Line=null, $File=null, $height=180, $width=800)
  2. {
  3. $dbg = debug_backtrace();
  4. print "<div style=\"width:".$width."px;float:left;margin:5px\">";
  5. print "<div style=\"border:1px solid #999;font-size:11px;\">";
  6. print "<div style=\"background-color:".$color.";padding:2px 5px;font-weight:bold;border-bottom:1px solid #999;\">";
  7. print $File;
  8. if($Line) print', LINE: '.$Line.' ';
  9. $offset = (isset($dbg[1])) ? 1:0;
  10. if($offset>0)
  11. print $dbg[$offset]["class"].$dbg[$offset]["type"].$dbg[$offset]["function"]."(".count( $dbg[$offset]["args"]).")";
  12. print "</div>";
  13. print "<textarea style=\"width:100%;height:".$height."px;border:none;padding:0 0 0 5px;font-size:11px\">";
  14. print_r($data);
  15. print "</textarea></div>";
  16. print "</div>";
  17. }
  18.  
  19. // Usage: pdbg("you string or var", "yellow", __LINE__,__FILE__,20);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.