Sub array from a big array

前端 未结 2 1045
刺人心
刺人心 2021-01-24 10:36

I need to get a sub array from a big array (i dont know the array, it comes from the database), like this:

$array = 
  array(0=>\'Name 1\',1=>\'Name 2\',2=         


        
相关标签:
2条回答
  • 2021-01-24 11:15
    $new_array = array_slice( $array, 0, 3);
    
    0 讨论(0)
  • 2021-01-24 11:26

    you could also try array_chunk() to separate your array into small ones

    0 讨论(0)
提交回复
热议问题