I was wondering...is it possible to use a value from an array which is currently being declared? Something like:
$a = array(
'foo' => 'value',
'bar' => $a['foo']
);
This is only a simple example. It would be pretty useful doing this, since it frees you from doing extra manipulation after the array declaration.
No, you can't, but you can do something like :
$a = array(
'foo' => ($val = 'value'),
'bar' => $val
);
No. $a['foo']
will only be available after the assignment completes entirely.