title: Show all public attributes (name and value) of an object
body: <p><a href="https://stackoverflow.com/questions/1372127/phps-function-to-list-all-objectss-attributes">This thread</a> didn't helped me.</p>
  
  <p>If I use</p>
  
  <pre><code>$class_vars = get_class_vars(get_class($this));
  
  foreach ($class_vars as $name =&gt; $value) {
      echo "$name : $value\n";
  }
  </code></pre>
  
  <p>I get</p>
  
  <p>attrib1_name : attrib2_name : attrib3_name</p>
  
  <p>There are no values. Also a private attribute is shown, which I don't want.</p>
  
  <p>If I use</p>
  
  <pre><code>echo "&lt;pre&gt;";
  print_r(get_object_vars($this));
  echo "&lt;/pre&gt;";
  </code></pre>
  
  <p>I get</p>
  
  <p>Array
  (
      [atrrib1_name] => attrib1_value
      [attrib2_name] => attrib2_value
  )</p>
  
  <p>Here again I have a private attribute and all sub attributes. But this time I have the values. How can I constrain this to one level?</p>
  
  <p>Isn't there a possibility to show all public attributes with their values of an object?</p>