You can convert a JSON string to a PHP array using the ‘json_decode‘ function:

$json = '{"name":"John Doe","age":32,"city":"New York"}';

$array = json_decode($json, true);

print_r($array);

The second argument true of json_decode function specifies that the function should return an associative array instead of an object.

2 thoughts on “How to convert json string into Php

Leave a Reply

Your email address will not be published. Required fields are marked *

Upgrade PHP Version without using cPanel setting