P
P
Pavel2020-04-30 09:07:09
PHP
Pavel, 2020-04-30 09:07:09

How to simplify an array so that each date is only 1 time?

there is an array with dates, they are repeated there 50+ times, how to make each date only 1 time?

Array
(
    [0] => Array
        (
            [users_id] => 19
            [date] => 2020-04-01
        )

    [1] => Array
        (
            [users_id] => 133
            [date] => 2020-04-01
        )

    [2] => Array
        (
            [users_id] => 87
            [date] => 2020-04-01
        )

    [3] => Array
        (
            [users_id] => 43
            [date] => 2020-04-01
        )

    [4] => Array
        (
            [users_id] => 132
            [date] => 2020-04-01
        )

    [5] => Array
        (
            [users_id] => 108
            [date] => 2020-04-01
        )
    [6] => Array
        (
            [users_id] => 108
            [date] => 2020-04-02
        )
 [7] => Array
        (
            [users_id] => 132
            [date] => 2020-04-02
        )
и т.п

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2020-04-30
@mrusklon

array_unique(array_column($arr, 'date'));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question