title: Extend PHP Array with __toString()
body: <p>Is there a way to extend the native PHP array with a __toString() function/method?</p>
  
  <p>I would like to be able to do</p>
  
  <pre><code>$a = array($x, $y, $z);
  echo $a;
  </code></pre>
  
  <p>This should neither complain with a <code>Array to string conversion</code> notice nor the dull output of <code>Array</code> but instead do whatever I implement in the __toString() method of the array.</p>
  
  <p>(In the __toString I would do something like iterate over the array and call __toString() on each element and concatenate that together to a string that describes the whole array.)</p>
  
  <p>(I know that this can be done through e.g. a wrapper object, that's not the question. I want to tweak PHP on a more subtle level.)</p>