Home >Backend Development >PHP Tutorial > 二维数组怎么值

二维数组怎么值

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 13:51:00990browse

二维数组如何值
比方说现在有个数组
$a=array(
  array(a=>1),
  array(a=>2),
  array(a=>3),
);
我现在就想要数组里面的前两个

变成
$a=array(
  array(a=>1),
  array(a=>2),
);
应该怎样实现


------解决方案--------------------
$a=array( 
array(a=> 1), 
array(a=> 2), 
array(a=> 3), 
); 
$a = array_splice($a, 0, 2);
echo var_dump($a);
?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn