Is it possible in PHP for an array to reference itself within its array elements?

adeinyotzm

New Member
I'm wondering if the elements of array can 'know' where they are inside of an array and reference that:Something like...\[code\]$foo = array( 'This is position ' . $this->position, 'This is position ' . $this->position, 'This is position ' . $this->position,),foreach($foo as $item) { echo $item . '\n';}//Results:// This is position 0// This is position 1// This is position 2\[/code\]
 
Back
Top