json usage in php

Solutions on MaxInterview for json usage in php by the best coders in the world

showing results for - "json usage in php"
Cristóbal
28 Feb 2018
1//Json Encode
2
3$person = array( 
4    "name" => "KINGASV", 
5    "title" => "CTO"
6); 
7$personJSON=json_encode($person);//returns JSON string
8
9//Json Decode
10
11$personJSON = '{"name":"KINGASV","title":"CTO"}';
12
13$person = json_decode($personJSON);
14
15echo $person->name; // KINGASV
16
17