实际上你所说的单值,也是存在键的,只不过php中可以省掉按顺序存储的键名
foreach ($a as $key => $val) { if (is_int($key)) { // 处理单值 } else { // 处理键值 } }