I have this value in SQL; {"1":"","3":"3","4":"5.11.1988"}
want parse this by php like:
$json = {"1":"","3":"3","4":"5.11.1988"};
echo $json['4']
5.11.1988
thanks for any advice
答案 0 :(得分:0)
in the documentation it notes that there is an optional second param to turn the decoded json object into an associative array so to be able to access your object in that manner all you need do is
$json = '{"1":"","3":"3","4":"5.11.1988"}';
$decodedJson = json_decode($json, true);
echo $decodedJson[4]; // or '4' if you prefer.
// 5.11.1988