If correctly understood from the comment, then the task, when accessing the key, is to derive all its possible values from the multidimensional array.
If so, you can stir up this:
$newArray = []; $commonArray = Array ( [0] => Array ( [0] => Array ( [ID] => 884 [UF_FIRSTNAME] => ТЕСТ [UF_MIDDLENAME] => ТЕСТ [UF_LASTNAME] => ТЕСТ ) [1] => Array ( [ID] => 885 [UF_FIRSTNAME] => ТЕСТ [UF_MIDDLENAME] => ТЕСТ [UF_LASTNAME] => ТЕСТ ) ) ) foreach ($commonArray as $values) { if (!empty($values)) { foreach ($values as $key => $value) { $newArray[$key][] = $value; } } }
and further we have the following structure
$newArray = [ 'ID' => [values...], 'UF_FIRSTNAME' => [values...], 'UF_MIDDLENAME' => [values...], 'UF_LASTNAME' => [values...], ]
and how to deduce this is the next question:
array_unique - if we want to leave only unique values
implode - if we want to output a string with a separator, for example
echo implode(', ', $newArray['UF_FIRSTNAME']); //все значения из ключей UF_FIRSTNAME
If you do not use array_unique, then when iterating over the keys, the internal value pointers will correspond as if they were in 1 array. for example
foreach ($newArray['ID'] as $key => $value) { echo 'ID is ' . $value; echo 'UF_FIRSTNAME for ID ' . $value . ' is ' . $newArray['UF_FIRSTNAME'][$key]; // etc }
I hope to guess)
array["ID"]- OlegArray( [0] => (Array[0]=>() Array[0]=>()...))- Evgeny PivovarovArray( [0] => (Array[0]=>() Array[1]=>()...))That's it, yes - Oleg