php - New 5.4 array short array syntax: Good practice? -
i'd use 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 syntax considered practice right now? or should stay old syntax?
usually practice related logic of code , not it's syntax, there's reason made new array syntax , reason is: faster coding , easier read. practice irrelevant here.
Comments
Post a Comment