Answer the question
In order to leave comments, you need to log in
How to get the value of a PHP variable?
How to get the value of "type"?
"attachments": [
{
"type": "photo",
"photo": {
"album_id": -15,
"date": 1582136311,
"id": 457260366,
"owner_id": 429096803,
"has_tags": false,
"access_key": "a12f2c2cgf40c7jb2b",
"sizes": [
{
"height": 89,
"url": "https://sun9-30.userapi.com/c543101/v543101998/625d9/GwG97jDNL1w.jpg",
"type": "m",
"width": 130
},
{
"height": 89,
"url": "https://sun9-60.userapi.com/c543101/v543101998/625db/bDfRBdlCG40.jpg",
"type": "o",
"width": 130
},
{
"height": 137,
"url": "https://sun9-71.userapi.com/c543101/v543101998/625dc/Yh_NBpkXB9E.jpg",
"type": "p",
"width": 200
},
{
"height": 220,
"url": "https://sun9-47.userapi.com/c543101/v543101998/625dd/8FbMQbDtLAc.jpg",
"type": "q",
"width": 320
},
{
"height": 298,
"url": "https://sun9-71.userapi.com/c543101/v543101998/625de/W4xn-gY4tAo.jpg",
"type": "r",
"width": 434
},
{
"height": 51,
"url": "https://sun9-6.userapi.com/c543101/v543101998/625d8/AwTTpbK3TCc.jpg",
"type": "s",
"width": 75
},
{
"height": 298,
"url": "https://sun9-19.userapi.com/c543101/v543101998/625da/CHDI_43mscw.jpg",
"type": "x",
"width": 434
}
],
"text": ""
}
}
]
Answer the question
In order to leave comments, you need to log in
Depends on json decoding options. If to an associative array, then $data['attachments'][0]['type'], if to an object, then $data->attachments[0]->type
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question