I have an array follow
[0] => Array
(
[month] => Oct
[amount] => 1200.00
)
and how do i get [amount] by passing [month]
You don't. Two options:
Loop:
foreach ($array as $i) {
if ($i['month'] == 'Oct') {
echo $i['amount'];
}
}
Index the data by month:
$array = array_combine(array_map(function($i) { return $i['month']; }, $array),
$array);
echo $array['Oct']['amount'];
month => [amount, ...] map, but that's a bit more complex. Just pointing it out :), it should be enough to get the OP started.
month => amountfor direct access.