[英]Get only first of two arrays which are combined in one array
If i var_dump my array $array_name
i get the following: 如果我var_dump我的数组
$array_name
我得到以下内容:
array(4) {
["lounge"]=>
string(0) ""
["terrasse"]=>
string(12) "ab 18:00 Uhr"
["vorverkauf"]=>
string(12) "ab 18:30 Uhr"
["titles"]=>
array(3) {
["lounge"]=>
string(6) "Lounge"
["terrasse"]=>
string(14) "Außenbar"
["vorverkauf"]=>
string(18) "Vorverkauf im 1.UG"
}
}
array(4) {
["lounge"]=>
string(0) ""
["terrasse"]=>
string(12) "ab 18:00 Uhr"
["vorverkauf"]=>
string(12) "ab 18:30 Uhr"
["titles"]=>
array(3) {
["lounge"]=>
string(6) "Lounge"
["terrasse"]=>
string(14) "Außenbar"
["vorverkauf"]=>
string(18) "Vorverkauf im 1.UG"
}
}
As you can see these are two arrays BUT they are not within one "master" array. 如您所见,这是两个数组,但它们不在一个“主”数组中。 I'd like to have only the first of these to arrays.
我只想将其中的第一个放入数组。
So i tried 所以我尝试了
var_dump($array_name[0])
which returns NULL var_dump($array_name[0])
返回NULL
What am i missing? 我想念什么?
At the end I would like to get ONLY from the first array the following value: 最后,我只想从第一个数组中获得以下值:
Something like $array[0]['titles]['lounge']
should output Lounge
$array[0]['titles]['lounge']
应该输出Lounge
Loop through each one printing the value And this is because you don't define a key for arrays with in array name 循环遍历每一个打印值,这是因为您没有为数组名称为in的数组定义键
foreach( $array_name as $sub_array_name){
echo $sub_array_name["titles"]["lounge"];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.