- json_decode: documentation ( source)
- print_r: documentation ( source)
- extract: documentation ( source)
<?php
$jsonString = '{
"order": {
"id": "5RTQNACF",
"created_at": "2012-12-09T21:23:41-08:00",
"status": "completed",
"total_btc": {
"cents": 100000000,
"currency_iso": "BTC"
},
"custom": "order1234"
}
}';
$array = json_decode($jsonString, true);
print_r($array);
extract($array);
echo $custom;