Answer the question
In order to leave comments, you need to log in
How to get value from json?
You need to get the status value.
But the value 236015091 is always different. How to do it?
$obj = json_decode($data);
echo $success=$obj->{"success"}; //Работает
//$status=$obj->{"return"}->{"xxxxxx???"}->{"status"}; //?????
{"success":1,"return":{"236015091":{"status":0,"pair":"rur_usd"}}}
Answer the question
In order to leave comments, you need to log in
<?php
$obj = json_decode($data, true);
$return = array_values($obj['return']); // Переиндексируем все значения в массиве
var_dump($return[0]['status']); // Если элементов в JSON несколько, то можно циклом пройтись и достать все данные, сейчас достаю только у 1 элемента
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question