D
D
Denis2018-06-12 13:50:55
PHP
Denis, 2018-06-12 13:50:55

How to search by PHP array keys?

hello
there is an array

20 => array:1 [▼
    10 => array:13 [▶]
    15 => array:13 [▶]
    25 => array:13 [▶]
  ]

I need to make a selection by the key of the second array, the
first key is the city ( element 20)
The second key in the list ( first element 10) is
minutes
such things are easily done, just by bitwin or by comparison.
But what about arrays? Arrange your foreach every time ? maybe there are ready-made functions in PHP, I didn’t find rocks myself

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-06-12
@webinar

if(isset( $arr['firstLevelKey']['secondLevelKey'] ))

wrap it in for and check, or better yet, while, until the condition is met.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question