Reputation: 3
Hi I'm trying to do this
$system = array(
'key1' => 'val1',
'key2' => 'val2',
'key3' => $system['key1'].'val3'
);
But when we echo key3 it ends up as just "val3" rather than "val1val3".
Is there a way around this problem?
Thanks!
Upvotes: 0
Views: 44
Reputation: 72961
Is there a way around this problem?
You can assign it after you declare $system
/key1
:
$system = array('key1' => 'val1', 'key2' => 'val2');
$system['key3'] = $system['key1'] . 'val3';
Upvotes: 4