#124 · Programming Language Tools Developer Tool

PHP Converter

Convert common PHP data representations such as arrays, JSON, query strings, JavaScript objects, and escaped strings without executing PHP code.

Developer Input

Local browser processing
spaces
Ad space

How to use this developer tool

  1. Select a conversion type.
  2. Paste static source data.
  3. Choose indentation and escaping options.
  4. Convert and review warnings.
  5. Copy or download the result.

What this developer tool does

It parses static literals and key/value structures, converts supported primitive types, and reports unsupported dynamic expressions rather than evaluating them.

Detect selected input format → parse supported literals → convert keys and primitive values → serialize output → report lossy or unsupported constructs.

Dynamic PHP expressions, function calls, object creation, constants resolved at runtime, and executable code cannot be evaluated by this browser-only converter.

Example

Input: ['name' => 'John', 'active' => true]

Output: valid JSON or JavaScript object syntax.

Tips for better output

  • Use static arrays for reliable conversion.
  • Quote all string keys.
  • Review output if the input contains constants or function calls.

FAQ

How do I convert a PHP array to JSON online?

Choose PHP Array to JSON and paste a static array literal.

How can I convert JSON into PHP array syntax?

Choose JSON to PHP Array. Valid JSON objects and arrays are converted recursively.

How do I convert a PHP array to a JavaScript object?

Choose PHP Array to JavaScript Object. The tool serializes the parsed static array as JavaScript-compatible object syntax.

Why can’t dynamic PHP expressions be converted to JSON?

They require a PHP runtime and may depend on files, variables, functions, or environment state.

How do I convert environment-style query data into a PHP array?

Choose Query String to PHP Array and paste key=value pairs joined with ampersands.

Supported conversions

ModulePurpose
PHP arrayJSON and JavaScript
JSONPHP array syntax
Query stringPHP array
StringEscape and unescape

Browse more developer tools

Calldeveloper category hub