I'd like to use the new short array syntax:
# Old syntax
$foo = array(
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3',
'key4' => array(
'key1' => 'value2',
'key2' => 'value2',
'key3' => 'value3',
'key4' => 'value4',
),
);
# New Syntax
$bar = [
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3',
'key4' => [
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3',
'key4' => 'value4',
],
];
Is that syntax considered as a good practice right now? Or should I stay with the old syntax?
Usually good practice is related to the logic of your code and not to it's syntax, There's a reason they made that new array syntax and that reason is: faster coding and easier to read. So good practice is irrelevant here.