title: Is it possible in PHP for an array to reference itself within its array elements?
body: <p>I'm wondering if the elements of array can 'know' where they are inside of an array and reference that:</p>
  
  <p>Something like...</p>
  
  <pre><code>$foo = array(
     'This is position ' . $this-&gt;position,
     'This is position ' . $this-&gt;position,
     'This is position ' . $this-&gt;position,
  ),
  
  foreach($foo as $item) {
  
    echo $item . '\n';
  }
  
  //Results:
  // This is position 0
  // This is position 1
  // This is position 2
  </code></pre>