Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
// 示例:将数组转换成 JSON
$data = [
"name" => "张三",
"age" => 25,
"skills" => ["PHP", "JSON", "MySQL"] // 修正变量名
];
// 转换为 JSON 字符串
$json = json_encode($data, JSON_UNESCAPED_UNICODE); // 修正常量名
echo $json;
// 解析 JSON(修正输入字符串)
$inputJson = '{"city":"北京","population":2171}'; // 使用英文引号
$decoded = json_decode($inputJson, true);
print_r($decoded);
?>