PHP Snippet 1:
foreach($array['options'] as $key => $value)
{
echo $value['pt']."<br>";
}
PHP Snippet 2:
$options = [
"front-electric" => [
"pt" => "Vidros Eléctricos dianteiros",
"en" => "Front electric"
],
"electric-diant-back" => [
"pt" => "Vidros Eléctricos diant. + trase.",
"en" => "Electric diant. + Back."
],
"darkened" => [
"pt" => "Vidros Escurecidos",
"en" => "Darkened"
],
"soundproofing-and-athermic" => [
"pt" => "Vidros Insonorizantes e Atérmicos",
"en" => "Soundproofing and Athermic"
]
];
PHP Snippet 3:
array_walk($data, function($v, $k) {echo "$v[pt]\n";});
PHP Snippet 4:
foreach($array['options'] as $key => $val){
echo $val['pt'];
}
PHP Snippet 5:
$json = '{"options": {
"front-electric": {
"pt": "Vidros Eléctricos dianteiros",
"en": "Front electric"
},
"electric-diant-back": {
"pt": "Vidros Eléctricos diant. + trase.",
"en": "Electric diant. + Back."
},
"darkened": {
"pt": "Vidros Escurecidos",
"en": "Darkened"
},
"soundproofing-and-athermic": {
"pt": "Vidros Insonorizantes e Atérmicos",
"en": "Soundproofing and Athermic"
}
}}';
$json_array = json_decode($json,true);
foreach($json_array as $key=>$values){
foreach($values as $subkeys=>$subvalues){
print $subvalues['pt'] . "<br/>";
}
}