函数名称:simdjson_decode()
适用版本:PHP 8.0.0及以上版本
函数用法:simdjson_decode()函数用于解析JSON字符串并将其转换为PHP数组或对象。
语法:mixed simdjson_decode(string $json [, bool $assoc = false [, int $depth = 512 [, int $options = 0 ]]])
参数:
返回值:解析成功时,返回解析后的PHP数组或对象。解析失败时,返回false。
示例:
$json = '{ "name": "John", "age": 30, "city": "New York" }';
$result = simdjson_decode($json);
// 输出结果
var_dump($result);
/*
array(3) {
["name"]=>
string(4) "John"
["age"]=>
int(30)
["city"]=>
string(8) "New York"
}
*/
注意事项: