H
H
Hannskod2018-02-25 17:37:27
PHP
Hannskod, 2018-02-25 17:37:27

How to remove duplicate elements in an array?

Good afternoon, there is an array collected in json

"to":
        {
          "10":
          {
            "out": 1.01,
            "in_min_amount": 100
          },
          "12":
          {
            "in": 12521.2,
            "in_min_amount": 100
          },
          "13":
          {
            "in": 1084,
            "in_min_amount": 0.1
          },
          "18":
          {
            "in": 1.0616,
            "in_min_amount": 100
          },
          "20":
          {
            "out": 26.1182,
            "in_min_amount": 20
          }
        }

I need to find all records where in_min_amount is repeated and remove this value

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
BushaevDenis, 2018-02-25
@BushaevDenis

Go through the double for, pushing each key into the buffer, and if it is already in the buffer, just delete it along the for path.

A
Artem, 2018-02-25
@proudmore

https://ideone.com/7Fd8tw

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question