var_dump wrapper


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

displayed filename and line number.

//normal use

d( $arg );

//some arguments

d( $arg1 , $arg2 , ... );


Copy this code and paste it in your HTML
  1. function d($var){
  2. $args=func_get_args();
  3. if(count($args)>1){
  4. $var=$args;
  5. }
  6. var_dump($var);
  7. $dump=ob_get_contents();
  8. $trace=debug_backtrace();
  9. $file=str_replace($_SERVER['DOCUMENT_ROOT'],"",$trace[0]['file']);
  10. $line=$trace[0]['line'];
  11. echo '<pre>';
  12. echo '<b>'.$file.' (Line:'.$line.')</b>'."\n";
  13. echo str_replace('<','&lt;',str_replace('>','&gt;',$dump));
  14. echo '</pre><br>'."\n";
  15. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.