测试:
$a = [ 'a'=>'Tom', 'b'=>'Mary', 'c'=>'Peter', 'd'=>'Jack' ]; $b = []; foreach ($a as $v) { $b[] = $v; } var_dump($a); var_dump($b);
结论:
$a: [ ‘a’=>’Tom’,’b’=>’Mary’,’c’=>’Peter’,’d’=>’Jack’]
$b: [ ‘a’=>’Tom’,’b’=>’Mary’,’c’=>’Peter’,’d’=>’Jack’]