如何在PHP中映射单个数组的值?

时间:2015-07-17 04:11:29

标签: php arrays

我有一个数组,例如

array (
  city => Newyork,
  amount => 1000
);

如何获得如下输出?

Newyork => 1000

1 个答案:

答案 0 :(得分:3)

没什么特别的,基本的php:

$a=array( 'city' => 'Newyork',
'amount' => '1000'
);

echo $a['city'] .  ' => ' . $a['amount'];