Alexander2016-12-02 17:36:05
Alexander, 2016-12-02 17:36:05

3 cycles in an array, how?

For me, a sore subject, arrays, cycles :(
I ask for help again ... There is a json string:

$json = '{"order":{"info":{"name":"test","login":"login"},"positions":[{"id":"210","amount":"1"},{"id":"110","amount":"1"},{"id":"310","amount":"1"}]}}';

Into her array! $arrayPositions = json_decode($json, TRUE);
And now the question is, you need to execute the script as many arrays in the positions array, at the same time, inside the array, get the amount and execute the script as many times as indicated in the amount ...
Thank you ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Maxim Fedorov, 2016-12-02

foreach ($arrayPositions['positions'] as $item) {
  echo $item['id'];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question