how to store json output into seperate PHP variables?
Agree with @jkon, please use the json_decode() to decode the json format into array. Then from the array, manually assign them into another variable(if it really needed).
You want 'separate' variables?
The json you supply will give the following with json_decode when 2nd param set to true:
['msg' => 'success', 'msg_text' => ['9912345678' => 'N']]
If you need to extract to separate variables you can do it manually:
$msg = $array['msg']; $msg_key = key($array['msg_text']); $msg_value = $array['msg_text'][$msg_key];
Alternatively use a loop to get key=>value.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.