title: Display data from private/protected properties and methods
body: <p>I am executing print_r() on an object. Which displays a nicely formatted output. However, I want to control the output. I want to be able to format and add titles/headers to certain sections of the output. print_r() is awesome but I cannot figure out how to access different lines within the output.
  I attempted to do something like this:</p>
  
  <pre><code>echo '&lt;h1&gt;ERRORS&lt;/h1&gt;';
  echo '&lt;h3&gt;Properties&lt;/h3&gt;';
  print_r(Exception::$message);
  </code></pre>
  
  <p>However, $message is set as a protected property so I ended up getting this error:</p>
  
  <pre><code>Fatal error: Cannot access protected property Exception::$message...
  </code></pre>
  
  <p>I don't want to access $message in order to modify it. I just want to display it like print_r() does...but nicely formatted my way. Perhaps I'm not fully understanding what 'access' really means.</p>
  
  <p>I also tried something like this also:</p>
  
  <pre><code>$lines = explode("\n", print_r(Exception::$message, true));
  foreach ($lines as $line) {
      echo $line;
  }
  </code></pre>
  
  <p>...but I get the same error</p>
  
  <pre><code>Fatal error: Cannot access protected property Exception::$message...
  </code></pre>
  
  <p>Is there a way to do this? Or is there a way to properly access the contents of print_r()?</p>