Advertisement
Guest User

Untitled

a guest
Jul 25th, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. <?php
  2.  
  3. ini_set('display_errors',1);
  4.  
  5. function __d($v, $var_dump = false, $xml_tidy = true){
  6.   if (!$var_dump){
  7.     $t = print_r($v,1);
  8.   }
  9.   else {
  10.     ob_start();
  11.       var_dump($v);
  12.     $t=ob_get_clean();
  13.   }
  14.  
  15.   if ($xml_tidy){
  16.     $t = str_replace('><', ">\n<", $t);
  17.   }
  18.   $t = htmlentities($t);
  19.  
  20.   print '<hr><pre class="daggerhart">'.$t.'</pre>';
  21. }
  22.  
  23.  
  24. class foo {
  25.   protected $t;
  26.  
  27.   function __construct(){
  28.     $this->t = 't has a value';
  29.   }
  30.  
  31.   function get_t(){
  32.     print 'inside of get_t();';
  33.     print __d($this);
  34.     print 'leaving get_t()';
  35.     return $this->t;
  36.   }
  37. }
  38.  
  39. class bar extends foo {
  40.   function __construct(){
  41.     print '$this->t';
  42.     __d($this->t);
  43.    
  44.     print 'parent::get_t()';
  45.     __d(parent::get_t());
  46.   }
  47. }
  48.  
  49. new bar();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement