JSON to PHP Array Converter
Convert JSON to PHP array syntax instantly. Supports nested associative and indexed arrays, all PHP data types, and both short [] and long array() notations.
Features
🐘 Idiomatic PHP
- Associative arrays with => syntax
- Nested array support
- Proper single-quote string escaping
- Optional $data variable assignment
🔣 Type-Accurate Output
- Strings in single quotes
- Numbers as PHP numeric literals
- Booleans as true / false
- JSON null mapped to PHP null
⚙️ Flexible Options
- Short [] or long array() syntax
- Toggle <?php tag inclusion
- Toggle variable assignment
- Download as .php file
PHP Array Guide
PHP Array Syntax
PHP supports both short array syntax (available since PHP 5.4) and the traditional array() function. Both are equivalent; short syntax is preferred in modern PHP.
// Short syntax (PHP 5.4+)
$data = [
'name' => 'Alice',
'age' => 30,
];
// Long syntax (all PHP versions)
$data = array(
'name' => 'Alice',
'age' => 30,
);