Can an array refer to itself

I have this associative array, where key2they key5will always have the same value as key1. Is it possible to set their values ​​by referring to the array itself or to any other suggestions for removing duplication of values?

$arr = array(
   'key1' => 'some value',
   'key2' => 'some value', //same as key1 and will always stay as key1
   'key3' => 'some other value',
   'key4' => 'yet another',
   'key5' => 'some value'  //same as key1 and will always stay as key1
);
+3
source share
1 answer

You can apply the &link after declaring the array:

$arr = array(...);
$arr["key2"] = & $arr["key1"];
$arr["key5"] = & $arr["key1"];
+10
source

All Articles