title: PHP: Is it faster to reuse object or copy into array
body: <p>I have a basic question that I was hoping someone could answer please.</p>
  
  <p>In PHP, is it quicker to refer back to properties of an object over and over again, or is it faster to copy those properties into an array, if they're being used so much?</p>
  
  <p>This is if you have an object already instantiated and populated fully. When you want to constantly pass some of that objects properties into various functions, should I just reuse the object, or is that in some way creating an overhead that it wouldn't in an array?</p>
  
  <p>Example:
  I have a Request object. This object has several search parameters. I want to keep on referring to these different search parameters, so currently I'm using:</p>
  
  <pre><code>$request-&gt;d-&gt;postcode
  </code></pre>
  
  <p>Someone suggested copying these search parameters into an array first, then re-using the array instead:</p>
  
  <pre><code>$searchParams = get_object_vars($request-&gt;d);
  </code></pre>
  
  <p>then I can simply use:</p>
  
  <pre><code>$searchParams['postcode']
  </code></pre>
  
  <p>Many thanks for any advice.</p>