You cannot initialize it, because PHP has not finished and initialized the whole array, so it cannot use its other values yet.
You will need to do this after initializing the first two elements:
$a = array(
'key1' => 5,
'key2' => 10
);
$a['key3'] = $a['key1'] + $a['key2'];
source
share