How to parse a multidimensional array into elements?

0 like 0 dislike
6 views
Good day, there is a multidimensional array of this form array(1) { [0]=> array(3) { [0]=> string(2) "EN" [1]=> string(2) "he" [2]=> string(2) "en" } }. How to parse a multidimensional array into elements? And generally is there a universal function that parses arrays of any nesting level? For simple arrays, use this code, but such an array (array(1) { [0]=> array(3) { [0]=> string(2) "EN" [1]=> string(2) "he" [2]=> string(2) "en" } }), he does not handle: foreach ($answer as $key => $value) { for ($i=0; $i < count($value); $i++) { if($value[$i] == 'call'){ $output .= "Calls"; }elseif($value[$i] == 'sms'){ $output .= "SMS"; }elseif($value[$i] == 'whatsapp'){ $output .= "WhatsApp"; }elseif($value[$i] == 'viber'){ $output .= "Viber"; } } }
by | 6 views

1 Answer

0 like 0 dislike
$countries = array( array("EN", "he", "en") ); foreach($countries as $country) { foreach($country as $country_code) { echo $country_code; } }
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
33,687 users