get first five array values - php

by Ramya 2014-03-05 14:47:31

get first five values in array

You can get first five values using array_slice() in PHP,
$passArrId = array_slice($pushArrId, 0, 5);


you can change the start value to get next five and next,...

just add a variable which changes the start value and limit it to get five values from the start,
$passArrId = array_slice($pushArrId, $start, 5);


this will result you five, five array values which will be helpful in the cases, when you use pagination,...

Razz
Razz
Razz
505
like
0
dislike
0
mail
flag

You must LOGIN to add comments