php

PHP Array Formatter

Re-indent PHP arrays into clean short-syntax.

Input
Formatted output

Formatted array appears here

Common questions

Does the PHP array formatter run on a server?

No. The array is parsed and re-formatted in your browser; nothing is uploaded anywhere.

Does it support both array() and short [] syntax?

Yes. It reads classic array(...) and short [...] syntax, including nested arrays, and always emits clean short-syntax output.

Will it change my data?

No. Only whitespace and indentation change. Keys, values, strings, and numbers are preserved exactly as you wrote them.

Can I choose the indentation?

Yes. Switch between 2 and 4 spaces, and every nesting level re-indents to match.

Are comments kept?

Comments (//, #, and /* */) are recognised while parsing but are not carried into the output, which focuses on the array structure.