title: How to slice the big array and return the sliced array based upon value of the argument page_no?
body: <p>I've a big array titled <code>$data</code>. For your reference I'm putting below only 14 elements of it. Practically it may contain hundreds of such elements:</p>
  
  <pre><code>Array
  (
      [0] =&gt; 16
      [1] =&gt; Array
          (
              [0] =&gt; Array
                  (
                      [user_id] =&gt; 199
                      [profile_page_id] =&gt; 0
                      [user_server_id] =&gt; 0
                      [user_name] =&gt; profile-199
                      [full_name] =&gt; Benjamin Jordon
                      [gender] =&gt; 0
                      [user_image] =&gt; 
                      [is_invisible] =&gt; 0
                      [user_group_id] =&gt; 6
                      [language_id] =&gt; 
                  )
  
              [1] =&gt; Array
                  (
                      [user_id] =&gt; 901
                      [profile_page_id] =&gt; 0
                      [user_server_id] =&gt; 1
                      [user_name] =&gt; profile-901
                      [full_name] =&gt; Campusknot .
                      [gender] =&gt; 0
                      [user_image] =&gt; 2014/11/b23e023750785c8b5e61ace4d6a202fa%s.png
                      [is_invisible] =&gt; 0
                      [user_group_id] =&gt; 6
                      [language_id] =&gt; 
                  )
  
              [2] =&gt; Array
                  (
                      [user_id] =&gt; 244
                      [profile_page_id] =&gt; 0
                      [user_server_id] =&gt; 0
                      [user_name] =&gt; profile-244
                      [full_name] =&gt; Campusknot .
                      [gender] =&gt; 0
                      [user_image] =&gt; 2015/02/0f34dbb95ce18b17611220b78c87f9a6%s.png
                      [is_invisible] =&gt; 0
                      [user_group_id] =&gt; 7
                      [language_id] =&gt; 
                  )
  
              [3] =&gt; Array
                  (
                      [user_id] =&gt; 200
                      [profile_page_id] =&gt; 0
                      [user_server_id] =&gt; 0
                      [user_name] =&gt; profile-200
                      [full_name] =&gt; Derius Galvez
                      [gender] =&gt; 0
                      [user_image] =&gt; 
                      [is_invisible] =&gt; 0
                      [user_group_id] =&gt; 6
                      [language_id] =&gt; 
                  )
  
              [4] =&gt; Array
                  (
                      [user_id] =&gt; 109
                      [profile_page_id] =&gt; 0
                      [user_server_id] =&gt; 0
                      [user_name] =&gt; profile-109
                      [full_name] =&gt; Hiten patel
                      [gender] =&gt; 0
                      [user_image] =&gt; 
                      [is_invisible] =&gt; 0
                      [user_group_id] =&gt; 6
                      [language_id] =&gt; 
                  )
  
              [5] =&gt; Array
                  (
                      [user_id] =&gt; 204
                      [profile_page_id] =&gt; 0
                      [user_server_id] =&gt; 0
                      [user_name] =&gt; profile-204
                      [full_name] =&gt; Huong Nguyen
                      [gender] =&gt; 0
                      [user_image] =&gt; 
                      [is_invisible] =&gt; 0
                      [user_group_id] =&gt; 6
                      [language_id] =&gt; 
                  )
  
              [6] =&gt; Array
                  (
                      [user_id] =&gt; 196
                      [profile_page_id] =&gt; 0
                      [user_server_id] =&gt; 1
                      [user_name] =&gt; profile-196
                      [full_name] =&gt; Ira Hampton
                      [gender] =&gt; 1
                      [user_image] =&gt; 2014/11/24c4a6835e667b67b82cea3666841ac7%s.jpg
                      [is_invisible] =&gt; 0
                      [user_group_id] =&gt; 6
                      [language_id] =&gt; 
                  )
  
              [7] =&gt; Array
                  (
                      [user_id] =&gt; 211
                      [profile_page_id] =&gt; 0
                      [user_server_id] =&gt; 0
                      [user_name] =&gt; profile-211
                      [full_name] =&gt; Kevin Rolando Vilcapaza Diaz
                      [gender] =&gt; 1
                      [user_image] =&gt; 
                      [is_invisible] =&gt; 0
                      [user_group_id] =&gt; 6
                      [language_id] =&gt; 
                  )
  
              [8] =&gt; Array
                  (
                      [user_id] =&gt; 202
                      [profile_page_id] =&gt; 0
                      [user_server_id] =&gt; 1
                      [user_name] =&gt; profile-202
                      [full_name] =&gt; Mai Le
                      [gender] =&gt; 0
                      [user_image] =&gt; 2014/08/ebaf98a8b7875b4814b06baceaccad22%s.jpg
                      [is_invisible] =&gt; 0
                      [user_group_id] =&gt; 6
                      [language_id] =&gt; 
                  )
  
              [9] =&gt; Array
                  (
                      [user_id] =&gt; 185
                      [profile_page_id] =&gt; 0
                      [user_server_id] =&gt; 1
                      [user_name] =&gt; profile-185
                      [full_name] =&gt; Perceus Mody
                      [gender] =&gt; 1
                      [user_image] =&gt; 2014/09/5f86df8752fd7079296c0101d235a592%s.jpg
                      [is_invisible] =&gt; 0
                      [user_group_id] =&gt; 6
                      [language_id] =&gt; 
                  )
  
              [10] =&gt; Array
                  (
                      [user_id] =&gt; 205
                      [profile_page_id] =&gt; 0
                      [user_server_id] =&gt; 1
                      [user_name] =&gt; profile-205
                      [full_name] =&gt; Phong Phan
                      [gender] =&gt; 0
                      [user_image] =&gt; 2014/08/d32361f1f72a4e24b9c8329501bc8aa1%s.jpg
                      [is_invisible] =&gt; 0
                      [user_group_id] =&gt; 6
                      [language_id] =&gt; 
                  )
  
              [11] =&gt; Array
                  (
                      [user_id] =&gt; 201
                      [profile_page_id] =&gt; 0
                      [user_server_id] =&gt; 1
                      [user_name] =&gt; profile-201
                      [full_name] =&gt; Rahul Gopal
                      [gender] =&gt; 1
                      [user_image] =&gt; 2014/09/d936e72dbad21732812c33e80752aad6%s.png
                      [is_invisible] =&gt; 0
                      [user_group_id] =&gt; 6
                      [language_id] =&gt; 
                  )
  
              [12] =&gt; Array
                  (
                      [user_id] =&gt; 208
                      [profile_page_id] =&gt; 0
                      [user_server_id] =&gt; 0
                      [user_name] =&gt; profile-208
                      [full_name] =&gt; SHUVAM SAHA
                      [gender] =&gt; 0
                      [user_image] =&gt; 
                      [is_invisible] =&gt; 0
                      [user_group_id] =&gt; 6
                      [language_id] =&gt; 
                  )
  
              [13] =&gt; Array
                  (
                      [user_id] =&gt; 212
                      [profile_page_id] =&gt; 0
                      [user_server_id] =&gt; 0
                      [user_name] =&gt; profile-212
                      [full_name] =&gt; Turner Corbin
                      [gender] =&gt; 0
                      [user_image] =&gt; 
                      [is_invisible] =&gt; 0
                      [user_group_id] =&gt; 6
                      [language_id] =&gt; 
                  )
  
          )
  
  )
  </code></pre>
  
  <p>From the above array please ignore the first key-value pair i.e.<code>[0] =&gt; 16</code>. Consider array present in <code>[1]</code> that contains 14 elements.</p>
  
  <p>Now what I want is a function to which I'll pass the array <code>$data</code> and an argument <code>page_no</code>. </p>
  
  <p>Suppose, if I've passed <code>page_no=1</code> then I should got first 10 records in return i.e. the following array: </p>
  
  <pre><code>Array
      (
  
                  [0] =&gt; Array
                      (
                          [user_id] =&gt; 199
                          [profile_page_id] =&gt; 0
                          [user_server_id] =&gt; 0
                          [user_name] =&gt; profile-199
                          [full_name] =&gt; Benjamin Jordon
                          [gender] =&gt; 0
                          [user_image] =&gt; 
                          [is_invisible] =&gt; 0
                          [user_group_id] =&gt; 6
                          [language_id] =&gt; 
                      )
  
                  [1] =&gt; Array
                      (
                          [user_id] =&gt; 901
                          [profile_page_id] =&gt; 0
                          [user_server_id] =&gt; 1
                          [user_name] =&gt; profile-901
                          [full_name] =&gt; Campusknot .
                          [gender] =&gt; 0
                          [user_image] =&gt; 2014/11/b23e023750785c8b5e61ace4d6a202fa%s.png
                          [is_invisible] =&gt; 0
                          [user_group_id] =&gt; 6
                          [language_id] =&gt; 
                      )
  
                  [2] =&gt; Array
                      (
                          [user_id] =&gt; 244
                          [profile_page_id] =&gt; 0
                          [user_server_id] =&gt; 0
                          [user_name] =&gt; profile-244
                          [full_name] =&gt; Campusknot .
                          [gender] =&gt; 0
                          [user_image] =&gt; 2015/02/0f34dbb95ce18b17611220b78c87f9a6%s.png
                          [is_invisible] =&gt; 0
                          [user_group_id] =&gt; 7
                          [language_id] =&gt; 
                      )
  
                  [3] =&gt; Array
                      (
                          [user_id] =&gt; 200
                          [profile_page_id] =&gt; 0
                          [user_server_id] =&gt; 0
                          [user_name] =&gt; profile-200
                          [full_name] =&gt; Derius Galvez
                          [gender] =&gt; 0
                          [user_image] =&gt; 
                          [is_invisible] =&gt; 0
                          [user_group_id] =&gt; 6
                          [language_id] =&gt; 
                      )
  
                  [4] =&gt; Array
                      (
                          [user_id] =&gt; 109
                          [profile_page_id] =&gt; 0
                          [user_server_id] =&gt; 0
                          [user_name] =&gt; profile-109
                          [full_name] =&gt; Hiten patel
                          [gender] =&gt; 0
                          [user_image] =&gt; 
                          [is_invisible] =&gt; 0
                          [user_group_id] =&gt; 6
                          [language_id] =&gt; 
                      )
  
                  [5] =&gt; Array
                      (
                          [user_id] =&gt; 204
                          [profile_page_id] =&gt; 0
                          [user_server_id] =&gt; 0
                          [user_name] =&gt; profile-204
                          [full_name] =&gt; Huong Nguyen
                          [gender] =&gt; 0
                          [user_image] =&gt; 
                          [is_invisible] =&gt; 0
                          [user_group_id] =&gt; 6
                          [language_id] =&gt; 
                      )
  
                  [6] =&gt; Array
                      (
                          [user_id] =&gt; 196
                          [profile_page_id] =&gt; 0
                          [user_server_id] =&gt; 1
                          [user_name] =&gt; profile-196
                          [full_name] =&gt; Ira Hampton
                          [gender] =&gt; 1
                          [user_image] =&gt; 2014/11/24c4a6835e667b67b82cea3666841ac7%s.jpg
                          [is_invisible] =&gt; 0
                          [user_group_id] =&gt; 6
                          [language_id] =&gt; 
                      )
  
                  [7] =&gt; Array
                      (
                          [user_id] =&gt; 211
                          [profile_page_id] =&gt; 0
                          [user_server_id] =&gt; 0
                          [user_name] =&gt; profile-211
                          [full_name] =&gt; Kevin Rolando Vilcapaza Diaz
                          [gender] =&gt; 1
                          [user_image] =&gt; 
                          [is_invisible] =&gt; 0
                          [user_group_id] =&gt; 6
                          [language_id] =&gt; 
                      )
  
                  [8] =&gt; Array
                      (
                          [user_id] =&gt; 202
                          [profile_page_id] =&gt; 0
                          [user_server_id] =&gt; 1
                          [user_name] =&gt; profile-202
                          [full_name] =&gt; Mai Le
                          [gender] =&gt; 0
                          [user_image] =&gt; 2014/08/ebaf98a8b7875b4814b06baceaccad22%s.jpg
                          [is_invisible] =&gt; 0
                          [user_group_id] =&gt; 6
                          [language_id] =&gt; 
                      )
  
                  [9] =&gt; Array
                      (
                          [user_id] =&gt; 185
                          [profile_page_id] =&gt; 0
                          [user_server_id] =&gt; 1
                          [user_name] =&gt; profile-185
                          [full_name] =&gt; Perceus Mody
                          [gender] =&gt; 1
                          [user_image] =&gt; 2014/09/5f86df8752fd7079296c0101d235a592%s.jpg
                          [is_invisible] =&gt; 0
                          [user_group_id] =&gt; 6
                          [language_id] =&gt; 
                      )           
  
      )
  </code></pre>
  
  <p>then if I pass page_no =2 then the subsequent set or records i.e.keys <code>[10],[11],[12],[13]</code> should get in return. The array keys should not start again from <code>[0]</code>. In other words I want array elements in bunch of 10 or less elements based on the value of argument page_no with original array keys intact.</p>
  
  <p>If no element is present for a specific page number then it should return false.</p>
  
  <p>How should I do this in an efficient way since the actual array might be very huge in size with hundreds of such elements? Please help me. Thanks.   </p>