Saturday, July 9, 2011

Tự động canh chỉnh code PHP, Autoindent PHP Array in Notepad++?

I'm currently having difficulty with auto-indenting PHP arrays that span multiple lines. The standard TextFX > TextFX Edit > Reindent C++ Code fails here.

For example, take the following code snippet:

php
$something
= array(
"test" => $var,
"nested" => array(
"subnest" = array(
"low" => "yes",
"foo" => "bar",
),
"bar" => "baz",
),
"last" => "yes",
);

Run "Reindent C++ Code" and get this:

php
$something
= array(
"test" => $var,
"nested" => array(
"subnest" = array(
"low" => "yes",
"foo" => "bar",
),
"bar" => "baz",
),
"last" => "yes",
);

Not really what I was after.

Is there any tool I'm missing or plugin that can properly indent PHP arrays in Notepad++?

No comments: