Answers for "use json in php file"

PHP
3

read json file data using php

$filedata = file_get_contents('filename.json');
$details = json_decode($filedata);
print_r($details);
Posted by: Guest on July-19-2021
15

json php

//Json Encode

$person = array( 
    "name" => "KINGASV", 
    "title" => "CTO"
); 
$personJSON=json_encode($person);//returns JSON string

//Json Decode

$personJSON = '{"name":"KINGASV","title":"CTO"}';

$person = json_decode($personJSON);

echo $person->name; // KINGASV
Posted by: Guest on July-16-2020

Browse Popular Code Answers by Language