Answers for "doreach json object php"

7

php return json

header('Content-type: application/json');
echo json_encode($array);
Posted by: Guest on March-20-2020
0

php get json array

$json = '
{
    "type": "donut",
    "name": "Cake",
    "toppings": [
        { "id": "5002", "type": "Glazed" },
        { "id": "5006", "type": "Chocolate with Sprinkles" },
        { "id": "5004", "type": "Maple" }
    ]
}';

$yummy = json_decode($json, true);

echo $yummy['toppings'][2]['type']; //Maple
Posted by: Guest on February-01-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language