Site icon NgDeveloper

array_chunk in php example

Array_chunk() is used to splits the array into many.

Syntax:

array_chunk($array,int_argument(each array contains this value));

 

Program:

<?php
$words = $argv;
echo "before chunk\n";
print_r($words);
echo "after chunk\n";
$words = array_chunk($words,2);
print_r($words);
?>

Output:

 

 

Thanks for reading this post………..!!!

Exit mobile version