PHP array syntax when converting from JSON
How JSON objects, arrays, strings and scalars translate into PHP array literals, and why single quotes and short syntax matter.
Associative versus indexed arrays
PHP has a single array type that doubles as both a list and a map. When this tool meets a JSON object it emits an associative array, pairing each key with its value using the => operator, for example 'name' => 'Ada'. When it meets a JSON array it emits an indexed array that lists the values with no keys at all, letting PHP assign the usual 0, 1, 2 positions automatically. That distinction is the single most important thing to get right, because a JSON object and a JSON array look similar but behave very differently once they are PHP.
Why single quotes and escaping
The converter always wraps string values in single quotes rather than double quotes. Single-quoted PHP strings do not interpret escape sequences or variables, so a value like a Windows path or a snippet containing a dollar sign is stored literally with no surprises. Only two characters need escaping inside single quotes: the backslash and the single quote itself. The tool doubles any backslash and prefixes any apostrophe, so text such as it's a test becomes 'it\'s a test' and remains valid PHP.
Short syntax and indentation choices
Since PHP 5.4 you can write arrays with square brackets instead of the array() function call, and the two forms are completely interchangeable. Ticking 'Short syntax [ ]' produces the [] form that most current coding standards recommend for readability. The indent dropdown then controls how nested levels are spaced, with 2 spaces suiting compact config files and 4 spaces matching teams that follow a wider style. The output keeps a trailing comma after the last item, which is legal in PHP and keeps future diffs small when you add a line.
Where a JSON to PHP array literal helps
Hand-writing a large configuration array is tedious and error prone, especially when you already have the data as JSON from an API response or an export. Pasting that JSON and copying the generated literal gives you a config file, a fixture, or a seed array in seconds. Because the output is plain PHP source rather than a runtime value, you can drop it directly into a return array in a config file, a test data provider, or a constant, without calling json_decode at all.