O
O
Optimus2015-03-14 13:35:08
PHP
Optimus, 2015-03-14 13:35:08

How to access a JSON element?

$test = json_decode($data);
var_dump($test);

In total we get:
object(stdClass)#1 (1) {
  ["response"]=>
  object(stdClass)#2 (2) {
    ["count"]=>
    int(5086)
    ["items"]=>
    array(19) {
      [0]=>
      object(stdClass)#3 (3) {
        ["id"]=>
        int(158)
        ["first_name"]=>
        string(10) "Иван"
        ["last_name"]=>
        string(10) "Иванов"
      }
    }
  }
}

I'm not catching up with something, how can I display only the id from object (stdClass) # 3 (3)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2015-03-14
Pyan @marrk2

If you are with the PHP syntax "on you", then do this
- it will be easier

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question