Advertisement
ez8377

Kohana debug::vars extension

Apr 21st, 2011
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.54 KB | None | 0 0
  1. public static function vars()
  2. {
  3.     if (func_num_args() === 0) return;
  4.     $variables = func_get_args();
  5.  
  6.     $output = array();
  7.     foreach ($variables as $var)
  8.     {
  9.         $backtrace = debug_backtrace();
  10.         $path = $backtrace[0]['file'];
  11.         $exploded_path = explode('\\', $path);
  12.         $filename = end($exploded_path);
  13.         $last_path_segment = prev($exploded_path);
  14.         $line = $backtrace[0]['line'];
  15.         $output[] = Debug::_dump($var, 1024).' ('.$last_path_segment.'/'.$filename.':'.$line.')';
  16.     }
  17.  
  18.     return '<pre class="debug">'.implode("\n", $output).'</pre>';
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement