Is there an elegant way to convert this JSON string:
{
"my_index": 1,
"first_name": "John",
"last_name": "Smith",
"address": {
"address1": "123 Main St",
"address2": "PO Box 123",
"city": "Anywhere",
"state": "CA",
"zip": 12345
}
}
To this PHP code block:
$data = array();
$data["my_index"] = 1;
$data["first_name"] = "John";
$data["last_name"] = "Smith";
$data["address"] = array();
$data["address"]["address1"] = "123 Main St";
$data["address"]["address2"] = "PO Box 123";
$data["address"]["city"] = "Anywhere";
$data["address"]["state"] = "CA";
$data["address"]["zip"] = 12345;
Basically, building code to paste into something else. I don't want a json_decode()'ed object. I literally want to end of with a string of PHP code, not a PHP object!