Answer the question
In order to leave comments, you need to log in
How to output a multidimensional php array?
Dumped a variable, how best to output an array? CMS Bitrix
Array
(
[0] => Array
(
[ID] => 8
[NAME] => Красивое оформление
[DESCRIPTION] =>
[ACTIVE] => Y
[DATE_UPDATE] => 2016-01-07 03:16:42
[OWNER_ID] => 1
[PARENT_ID] => 0
[SITE_ID] =>
[KEYWORDS] =>
[ITEMS_COUNT] =>
[ML_TYPE] => 1
)
[1] => Array
(
[ID] => 5
[NAME] => Фотографии сотрудников
[DESCRIPTION] =>
[ACTIVE] => Y
[DATE_UPDATE] => 2016-01-07 01:57:13
[OWNER_ID] => 1
[PARENT_ID] => 0
[SITE_ID] =>
[KEYWORDS] =>
[ITEMS_COUNT] =>
[ML_TYPE] => 1
)
)
Answer the question
In order to leave comments, you need to log in
foreach
$iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($array));
foreach($iterator as $key => $value) {
if ($key==='ID' || $key==='NAME') echo "$key => $value\n";
}
foreach($array as $key => $items){
foreach($items as $k => $value){
echo "$k : $value";
}
}
you seem to want something
foreach($a as $v){
echo $v['id'], ':', $v['name'], ' ';
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question