Hide specific class fields from print_r or var_dump
<p>Is it possible to hide a specific class fields from print_r ?</p>

<pre><code>&lt;?php

class DataManager {
    public $data = array();
}

class Data {
    public $manager;
    public $data = array();

    public function Data ($m, $d) {
        $this-&gt;manager = $m;
        $this-&gt;data = $d;
    }
}

$manager = new DataManager();

for ($a = 0; $a &lt; 10; $a++) {
    $manager-&gt;data[] = new Data($manager, 'Test ' . md5($a));
}

echo '&lt;pre&gt;';
print_r($manager);

?&gt;
</code></pre>

<p>This would print</p>

<blockquote>
  <p>DataManager Object (
      [data] => Array
          (
              [0] => Data Object
                  (
                      [manager] => DataManager Object  <em>RECURSION</em>
                      [data] => Test cfcd208495d565ef66e7dff9f98764da
                  )</p>

<pre><code>        [1] =&gt; Data Object
            (
                [manager] =&gt; DataManager Object  *RECURSION*
                [data] =&gt; Test c4ca4238a0b923820dcc509a6f75849b
            )    .......
</code></pre>
</blockquote>

<p>Is it possible to somehow change the output behavior so it print's like this? Like with DocComment /** @hidden **/ </p>

<blockquote>
  <p>DataManager Object (
      [data] => Array
          (
              [0] => Data Object
                  (
                      [data] => Test cfcd208495d565ef66e7dff9f98764da
                  )</p>

<pre><code>        [1] =&gt; Data Object
            (
                [data] =&gt; Test c4ca4238a0b923820dcc509a6f75849b
            )
</code></pre>
</blockquote>

<p>If not, is there some sort of PHP lib that maybe uses Reflection and somehow bypasses stuff? </p>

<p>Thanks</p>
