title: When looping through object, loop through specific property
body: <p>I see in laravel for example, when looping through eloquent model it loops only through table attributes. For example</p>
  
  <pre><code>$user = new User(1);
  foreach($user as $key =&gt; $value){
     echo $key.' = '.$value.'&lt;br&gt;';
  }
  </code></pre>
  
  <p>the output will be like this</p>
  
  <pre><code>id=1
  first_name=jone
  </code></pre>
  
  <p>It loops only through table columns although the class has other attributes</p>
  
  <p>My class is like this</p>
  
  <pre><code>class Model {
    protected $prop1;
    protected $prop2;
    protected $columns = ['id' =&gt; 1, 'name' =&gt; 'name'];
  }
  </code></pre>
  
  <p>I wanna implement something like that, so when I create an object and loop through it, only loop through <code>$columns</code> propery for example</p>
  
  <pre><code>$model = new Model();
  foreach($model as $key =&gt; $value){
         echo $key.' = '.$value.'&lt;br&gt;';
  }
  </code></pre>
  
  <p>i need the output to be like this</p>
  
  <pre><code>id=1
  name=name
  </code></pre>