P
P
Pavel2016-02-02 16:04:02
PHP
Pavel, 2016-02-02 16:04:02

Select from a multidimensional array, only those whose keys match certain values?

Actually the question is in the title. Basically, there is an array

Array
(
    [0] => Array
        (
            [value1] => one
            [value2] => two
            [value3] => three
        )

    [1] => Array
        (
            [value1] => two
            [value2] => 2
            [value3] => set
        )

    [2] => Array
        (
            [value1] => destroy
            [value2] => optimum
            [value3] => one
        )

    [3] => Array
        (
            [value1] => one
            [value2] => purget
            [value3] => three
        )

    [4] => Array
        (
            [value1] => three
            [value2] => colisted
            [value3] => qwerty
        )

)

from this multidimensional array, you need to select only those that correspond to the following values:
value1 = 'one' или value = 'three'
and those that correspond to these values:
value1 = 'one'  и value2 = 'two' и value3 = 'three'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri, 2016-02-02
@riky

php.net/manual/en/function.array-filter.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question