V
V
Vitaly2017-04-02 21:54:09
PHP
Vitaly, 2017-04-02 21:54:09

How to extract the items parameter?

The VK API has a group.get method that returns two parameters in json: count and items
For example, I can extract the count parameter like this: $count=$zapros->response[0]->count;
Because it looks like all normal parameters: parameter:value
But there is a problem with items, there are several values ​​and everything looks like this: items:[value, value...], how to extract all these values ​​from items ??? Just like with count, it doesn’t work, square brackets or several values ​​interfere (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Goryachkin, 2017-04-02
@abaddon65

Well, for example:

$test = json_decode($json_string);
//Выведет 142342685
echo $test->response->items[0];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question