Getting values from a multidimensional array in php -
this question has answer here:
- how extract data json php? 2 answers
i've multidimesional array in php code ...
$waypoints = $_post['waypoints']; print_r ($waypoints);
that returns
[["1dcb4f6575fbf5ee4ebd542d5981a588",7.67468,44.91085],["7503c3e97935960d0f7abcb6f7ad70f4",7.67614,44.90977]]
i need values @ index = 1 , index = 2 in array: if try value
7.67468
using
print_r ($waypoints[0][1]);
i obtain
notice: uninitialized string offset: 1
as error
using
print_r ($waypoints[0]);
i obtain
[
as error
suggestions?
as $_post['waypoints']
json_encod
ed string, try part of code:
// decode json-string array $waypoints = json_decode($_post['waypoints'], true); // if want check have: print_r($waypoints) // echo required item: echo $waypoints[0][1];
more json
can find here, in documentation, or google.
Comments
Post a Comment