Is there a way of referencing an array key from within the array? This may make more sense in code format:
$array=array(
"Key1"=>array(
"Value1",
"Value2"
),
"Key2"=>&$this['Key1']
);
What I want is for $array['Key2']
to output the same as $array['Key1']
. I can add $array['Key2']=&$array['Key1'];
after the array is created, but would like to keep it all in one code block if possible.
I've checked the docs on references, as well as some of the suggest similar questions here and a search for "php array reference".
question from:https://stackoverflow.com/questions/10358261/php-self-referencing-array