I
I
Ibishka2020-04-27 11:30:41
PHP
Ibishka, 2020-04-27 11:30:41

How to iterate over such PHP array?

$arr = [{1: 4},{5: 2},{6: 45}...];
Did so

foreach ($arr as $obj) {
  foreach ($obj as $id => $count) {
    echo $id;
    echo $count;
  }
}

Is there a better iteration?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question