$array = array(
'name' => 'john',
'age' => '25',
'birthday' => '02-03-1988',
'gender' => 'male',
'telephone' => '98676878',
'location' => 'Australia'
);
$array_slice = array_slice($array, 0, 3);
foreach($array_slice as $key => $val) {
if($key !== 'age') {
echo $key.' => '.$val.'<br>';
}
}
输出:
name => john
birthday => 02-03-1988
如何显示3个数组值?
所以,我希望输出是这样的:
name => john
birthday => 02-03-1988
gender => male
我是程序员的初学者,谢谢你的帮助。
答案 0 :(得分:0)