01-06-2008, 04:53 PM
|
#1 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
Indentation style of an array
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.
I used to format my arrays like the following:
php Code:
$this-> m_aAccounts[ $szUsername] = array ( 'username' => $szUsername, 'password' => $szPassword, 'level_name' => $pLevel-> getLevelName(), 'level_flags' => $pLevel-> getLevelFlags() );
But even that is wasting so much white-space to the left of each item. Therefore recently I've been using the following styling method which I feel is far better:
php Code:
$this-> m_aAccounts[ $szUsername] = array( 'username' => $szUsername, 'password' => $szPassword, 'level_name' => $pLevel-> getLevelName(), 'level_flags' => $pLevel-> getLevelFlags());
This is taken from the way I format my Javascript dynamic functions, like so:
javascript Code:
$('myElement').onclick = function() { // Do something fancy. }
How do you go about indenting your arrays? I'm curious 
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|