Array
(
[university] => 57
[iit] => 57
[jee] => 44
[application] => 28
[study] => 26
[college] => 23
[exam] => 19
[colleges] => 19
[view] => 19
[amp] => 18
)
如何获得前5个元素的数组?
答案 0 :(得分:71)
使用array_slice()
功能:
$newArray = array_slice($originalArray, 0, 5, true);
答案 1 :(得分:3)