PHP Array to JSON Converter

مطور
إعلان · يزيل؟
إعلان · يزيل؟

مرشد

PHP Array to JSON Converter

PHP Array to JSON Converter

Convert PHP array syntax to valid JSON format instantly. Paste PHP arrays using either the classic array() or modern [] short syntax, and get properly formatted JSON output. Handles nested arrays, associative key-value pairs, PHP constants (true, false, null), and trailing commas.

كيف تستعمل

Paste your PHP array code into the input area, select your preferred indentation style, and click يتحول. The tool parses the PHP array syntax and outputs equivalent JSON. Choose between 2 spaces, 4 spaces, tabs, or minified output.

سمات

  • Both Array Syntaxes – Supports classic array() and modern [] short array syntax
  • Nested Arrays – Handles deeply nested arrays and mixed structures
  • Associative Arrays – Converts => key-value pairs to JSON colon syntax
  • PHP Constants – Properly converts true, false, null (case-insensitive) to JSON equivalents
  • مسافة بادئة قابلة للتكوين – Output with 2 spaces, 4 spaces, tabs, or minified
  • Trailing Comma Support – Handles trailing commas that are valid in PHP but not JSON
  • نسخ وتنزيل – One-click copy or download the JSON output
  • من جانب العميل فقط – All conversion happens in your browser

إعلان · يزيل؟

التعليمات

  1. What PHP array syntax is supported?

    The tool supports both PHP array syntaxes: the classic array() function syntax and the modern [] short array syntax introduced in PHP 5.4. It handles indexed arrays (array(1, 2, 3)), associative arrays (array('key' => 'value')), nested arrays, mixed arrays, single-quoted and double-quoted strings, numeric values, boolean constants (true/false/TRUE/FALSE), null values, and trailing commas.

  2. What are the differences between PHP arrays and JSON?

    PHP arrays are more flexible than JSON in several ways. PHP allows both single and double quoted strings, while JSON requires double quotes. PHP supports trailing commas after the last element, which JSON does not. PHP arrays can have integer keys that start at any number, while JSON arrays are always zero-indexed. PHP has the => operator for key-value pairs, while JSON uses colons. This tool handles all these differences during conversion.

  3. Can this tool handle PHP variables or expressions in arrays?

    No — this tool converts static PHP array literals only. It cannot evaluate PHP variables ($var), function calls, concatenation, or other expressions. The input should contain only literal values: strings (quoted), numbers, booleans (true/false), null, and nested arrays. If your PHP array contains dynamic values, you will need to evaluate them in PHP first and then convert the resulting static array.

هل تريد حذف الإعلانات؟ تخلص من الإعلانات اليوم

تثبيت ملحقاتنا

أضف أدوات IO إلى متصفحك المفضل للوصول الفوري والبحث بشكل أسرع

أضف لـ إضافة كروم أضف لـ امتداد الحافة أضف لـ إضافة فايرفوكس أضف لـ ملحق الأوبرا

وصلت لوحة النتائج!

لوحة النتائج هي طريقة ممتعة لتتبع ألعابك، يتم تخزين جميع البيانات في متصفحك. المزيد من الميزات قريبا!

إعلان · يزيل؟
إعلان · يزيل؟
إعلان · يزيل؟

ركن الأخبار مع أبرز التقنيات

شارك

ساعدنا على الاستمرار في تقديم أدوات مجانية قيمة

اشتري لي قهوة
إعلان · يزيل؟