H
H
hellsontime2020-01-27 09:47:09
PHP
hellsontime, 2020-01-27 09:47:09

How to access json element in php?

There is a response from the server:

{
"result": {
"balance": 15023.66
}
}

How to access the value of balance directly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-01-27
@hellsontime

https://www.php.net/manual/en/function.json-decode.php

$balance = json_decode($json, true);
echo $balance['result']['balance'];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question