我有一个数组跟随
[0] => Array
(
[month] => Oct
[amount] => 1200.00
)
Run Code Online (Sandbox Code Playgroud)
我怎么[amount]通过路过[month]
你没有.两种选择:
环:
foreach ($array as $i) {
if ($i['month'] == 'Oct') {
echo $i['amount'];
}
}
Run Code Online (Sandbox Code Playgroud)按月索引数据:
$array = array_combine(array_map(function($i) { return $i['month']; }, $array),
$array);
echo $array['Oct']['amount'];
Run Code Online (Sandbox Code Playgroud)