I am merely wondering as to how people indent their arrays. For example, when you have an array with some pretty substantial lines, putting it all on one line isn't usually the greatest style in the world because you then get stupidly long lines.
It's pretty much the same as your second method but without placing the opening and closing brackets on their own line. I think that removes the relation to the function and still provides a good solution. Thoughts?
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
I generally follow a similar approach to the last post, by sjaq, except that indent depths are always the same (one tab; don't hate me for using tabs) whereas the initial indent is double the length in the code posted above.
I know the following is not strictly about indentation, but I feel it applies here. I like to keep all of the 'key value' (=>) operators nicely lined up as well (using spaces as padding).
All in all, it's just personal preference and one that I've adopted over time.
// If I were feeling really pernickety,
// I'd order the keys alphabetically ;-)
$aSample = array (
'errorController' => 'error',
'defaultAction' => 'index',
'debug' => true,
'rootSafety' => true,
'fileCommand' => 'usr/bin/file',
'logs' => array (
'error' => 'error.log',
'default' => 'log.log'
'timezone' => 'Europe/Amsterdam'