是yii2的初学者。在我的程序中有一个名为Place
的数组。它包含如下值:
Array
(
[0] => Array
(
[0] => Aluva
[1] => Paravoor
)
[1] => Array
(
[0] => Ernakulam
[1] => Paravoor
)
[2] => Array
(
[0] => Aluva
[1] => Ernakulam
)
[3] => Array
(
[0] => Kottuvally
[1] => Paravoor
)
)
如何从此数组中检索每个元素?
答案 0 :(得分:1)
使用foreach?
library(alr4)
library(ggplot2)
p <- ggplot(walleye, aes(x= age)) + geom_histogram() + facet_grid(~age)
p %+% subset(walleye, age %in% 1:4)
答案 1 :(得分:1)
示例代码 -
<?php
$data = array(
0 => array(0=>'Aluva', 1=>'Paravoor'),
1 => array(0=>'Ernakulam', 1=>'Paravoor'),
2 => array(0=>'Aluva', 1=>'Ernakulam'),
3 => array(0=>'Kottuvally', 1=>'Paravoor')
);
foreach ($data as $key => $value) {
foreach ($value as $key1 => $value1) {
echo '<br>'.$value1;
}
}
答案 2 :(得分:1)
myScript1.py
$var = $Place[0][1];
现在在哪里&#34; Paravoor&#34;
答案 3 :(得分:1)
您可以使用array_walk函数
$total = [];
array_walk($sales, function($value) use(&$total) {
foreach ($value as $key => $arr) {
echo $arr. "<br>";
}
});