Home > Backend Development > PHP Tutorial > JSON format to PHP array method

JSON format to PHP array method

小云云
Release: 2023-03-21 09:48:01
Original
1401 people have browsed it

This article mainly shares with you the method of converting JSON format into PHP array, hoping to help everyone.

<?php
$str=<<<str
        [
{
"value": 30,
"color":"#F38630"
},
{
"value" : 50,
"color" : "#E0E4CC"
},
{
"value" : 100,
"color" : "#69D2E7"
}
 
]
str;
//通过json_decode方法将json格式的字符串转换为数组
$arr=json_decode($str,true);
var_dump($arr);
die;
?>
Copy after login

Related recommendations:

How to convert JSON data format into PHP array

How to convert this jsp code into PHP code

List parsing-how to convert python list string into php array

The above is the detailed content of JSON format to PHP array method. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template