A
A
Al2017-11-02 15:11:23
PHP
Al, 2017-11-02 15:11:23

How to display the value of a multidimensional array?

Help me display [name] => Well-Worn with the condition that the nesting of the array is always different and I need to check: if the array contains the string [category] => Exterior display the value [name]
Array (
[0] => Array ( [ internal_name] => CSGO_Type_Pistol [name] => Pistol [category] => Type [category_name] => Type )
[1] => Array ( [internal_name] => weapon_fiveseven [name] => Five-SeveN [category] => Weapon [category_name] => Weapon )
[2] => Array ( [internal_name] => set_train [name] => The Train Collection [category] => ItemSet [category_name] => Collection )
[3] => Array ( [ internal_name] => normal [name] => Normal [category] => Quality [category_name] => Category )
[4] => Array ( [internal_name] => Rarity_Common_Weapon [name] => Consumer Grade [category] => Rarity [color] => b0c3d9 [category_name] => Quality )
[5] => Array ( [internal_name] = > WearCategory3 [name] => Well-Worn [category] => Exterior [category_name] => Exterior )
Thank you very much.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maksim Fedorov, 2017-11-02
@GrafMonteCristo

corrected...

foreach($items as $item){
    echo $item['category'] == 'Exterior' ? $item['name'] :  false;
}

A
Anton Mashletov, 2017-11-02
@mashletov

array_walk_recursive

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question