Nolias
Nolias

Reputation: 111

Netbeans PHP spaces in array declaration

Simple question, I have array:

array(
  'aaa' => 1,
  'bbbbbbbb' => 2,
  'ccccc' => 3,
  'dd' => 4
);

and I want format code to:

array(
  'aaa'       => 1,
  'bbbbbbbb'  => 2,
  'ccccc'     => 3,
  'dd'        => 4
);

Is there a Formatting option to do this, because I don't see anything like this?

PS. Sorry for my English.

Upvotes: 4

Views: 859

Answers (2)

Arshi
Arshi

Reputation: 511

I am working on NETBEAN for so long, The Best practise is alt+shift+F

Upvotes: 5

Chetan Ameta
Chetan Ameta

Reputation: 7896

PHP code into NetBeans 7.1 In Alignment category there are new properties for Group Multiline Alignment - Assignment and Array Initializer.

enter image description here

On the left site - Assignment property is off and on the right site the property is on. As you can see, when the property is set on, then the assignment char '=' is placed after the longest identifier in a group. The group is defined as a number of lines that contains the same type of assignments. End of a group can be empty line, line where is only a comment, different expression, end of a block. This formatting options works for variable assignment, field initialization and constants.

The second new property is for Array Initializer.

Both properties are switched off by default. Just turn it on and you are done.

Upvotes: 9

Related Questions