Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!
We spend hours scrolling social media and waste money on things we forget, but won’t spend 30 minutes a day earning certifications that can change our lives.
Master in DevOps, SRE, DevSecOps & MLOps by DevOps School!
Learn from Guru Rajesh Kumar and double your salary in just one year.
we can convert JSON string to an array with the help of json decode() function. This functon accepts the JSON string as the first parameter and a few additional parameters to control the process of converting JSON to PHP array.
we use the json decode() function to convert JSON string to an array in php.


example
<?php
$json_string = '{"mp": "gwalior", "bhopal": "delhi", "mumbai": "gujrat"}';
echo "<pre>";
print_r (json_decode($json_string));
echo "</pre>";
?>
output
stdClass Object
(
[mp] => gwalior
[bhopal] => delhi
[mumbai] => gujrat
)