B
B
bone_games2021-05-07 13:41:30
PHP
bone_games, 2021-05-07 13:41:30

How to parse json array foreach?

Probably the most simple array)
I get an array of users using the post method

"data": [
        {
            "name": "Ivan",
            "telephone": "1111",
            "id": "1"
        },
        {
            "name": "Ivan2",
            "telephone": "2222",
            "id": "2"
        },
        {
            "name": "Ivan3",
            "telephone": "123445453333",
            "id": "3"
        }
    ]


I need to add to the database of each user trying to parse foreach

foreach($post['data'] as $contact) {

}

As I understand it, I get only one entry from the array. What am I doing wrong?
Thank you all in advance.

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