Hi
I am looking for a php code formatter that has to has two features:
formatting arrays, so an array like this:

array ('key_of_first_value' => 'value','another_key' => 'value1', 'test_key' => 'value2');

to this (note that the sign => is aligned among all array elements):

array (
'key_of_first_value'   => 'value',
'another_key'          => 'value1',
'test_key'             => 'value2'
);

the second feature is aligning variables and their values when they are consecutive, so this code:

$var = 'test';
$another_var = 'another test';
$variable = 'test also';
$test_variable = 'for test only';

will look like this:

$var            = 'test';
$another_var    = 'another test';
$variable       = 'test also';
$test_variable  = 'for test only';

I have been googling about this for hours but with no luck.

Recommended Answers

All 3 Replies

Google is your friend.
I would suggest using preg_match_all to retrieve the data then display the data in the proper formatting with loops.

I use Polystyle, but it doesn't offer what you ask. But you could ask their support. It may be a feature I haven't found yet (since I don't code like that).

Thanks for reply

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.