title: Should I pass whole object as function parameter?
body: <p>Assume we have some object</p>
  
  <pre><code>$a = new stdClass;
  $a-&gt;b = 7;
  $a-&gt;c = 'o';
  $a-&gt;d = array(1,2,3);
  </code></pre>
  
  <p>Also we have a function which doing something with <em>some of</em> properties of our object (for example <code>b</code> and <code>d[1]</code>).</p>
  
  <p><strong>My question</strong>: Should my function accept whole object as a parameter like:</p>
  
  <pre><code>function some($a) {
   var_dump($a-&gt;b);
   var_dump($a-&gt;d[1]);
  }
  
  some($a);
  </code></pre>
  
  <p>or accept only certain fields which it's process like:</p>
  
  <pre><code>function some($b, $d) {
   var_dump($b);
   var_dump($d);
  }
  
  some($a-&gt;b, $a-&gt;d[1]);
  </code></pre>
  
  <p>Actually no matter is <code>$a</code> object or array.</p>