C
C
chelkaz2018-04-17 16:49:19
PHP
chelkaz, 2018-04-17 16:49:19

How to get key value in multidimensional array?

Constantly different arrays of the form come:

Array
(
    [37:10] => Array
        (
            [VALUE] => 55.75303026534,37.463532104492
        )

)

Array
(
    [37:05] => Array
        (
            array 
            (
                    [VALUE] => 55.75303026534,37.463532104492
            )
        )

)

In them, I'm only interested in the VALUE key and its value.
How easy is it to get the value? An array can be nested differently, but the VALUE key is always the same in different places...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_RED, 2018-04-17
@Stalker_RED

php.net/manual/en/function.array-walk-recursive.php

array_walk_recursive (&$data, function($val, $key) {
  if ($key === "VALUE") echo $val;
})

A
Alex McArrow, 2018-04-17
@AlexMcArrow

Convert to json string and "pull out" regular expression?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question