# phparray

array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
[5] => 6
[6] => 7
[7] => 8
[8] => 9
)
array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
[5] => 6
)
array
(
[0] => 7
[1] => 8
[2] => 9
[3] => 4
[4] => 5
[5] => 6
)

array
(
[0] => a
[1] => b
[2] => c
[3] => d
[4] => e
[5] => f
[6] => a
[7] => x
[8] => y
)
array
(
[0] => a
[1] => b
[2] => c
[3] => d
[4] => e
[5] => f
)
array
(
[0] => a
[1] => x
[2] => y
[3] => d
[4] => e
[5] => f
)

array
(
[0] => a
[1] => b
[2] => c
[3] => d
[4] => e
[5] => f
[6] => a
[7] => x
[8] => y
)
array
(
[1] => a
[2] => b
[3] => c
[4] => d
[5] => e
[6] => f
[7] => x
[8] => y
)
array
(
[1] => a
[7] => x
[8] => y
[2] => b
[3] => c
[4] => d
[5] => e
[6] => f
)

array_slice()函数将返回数组中的一部分，从键offset开始，到offset+length位置结束。其形式：

php代码
1.array array_slice (array array, int offset[,int length])
array array_slice (array array, int offset[,int length])
offset 为正值时，拆分将从距数组开头的offset 位置开始；如果offset 为负值，则拆分从距数组末尾的offset 位置开始。如果省略了可选参数length，则拆分将从offset 开始，一直到数组的最后一个元素。如果给出了length 且为正数，则会在距数组开头的offset+length 位置结束。相反，如果给出了length且为负数，则在距数组开头的count(input_array)-|length|位置结束。考虑一个例子：

php代码

php代码

http://www.bkjia.com/phpjc/629036.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/629036.htmltecharticle对数组的array_merge函数和+运算符比较迷惑，写了个小程序比较下发现了他们的不同。特别是+运算符，他的意思是，将右边的数组单元（去重…

Posted in 未分类