PHP array chunk Function

Array chunk function allows you to split the array by a certain number of characters in php array operations. For example, there are 20 records coming from the database and you want to make two loops in 10 10 of them. For this, you can divide the array coming from the database with array_chunk and list them.


  $city=array("Paris","London","Sidney","Helsinki","Tokyo","New York","İstanbul");


In the above example, the array will become new arrays in the number of items with the specified division value.

The numerical value given in the division operations with Array chunk may be less than the previous arrays in the last loop. If you divide 2 pieces out of 9 records, the last array element will be 1.

0 Yorum

Soru & Yorum

Web Tasarım

Renkli Kare

Web Tasarım Ajansı