Previous | Home | Next |
<html> <head> <title>array chunk</title> </head> <body> <?php $A = array("Aditya","Mukund","Harsh", "Somaru","Sachine","Ramesh","Suresh"); // shuffle the cards shuffle($A ); // Use array_chunk() to divide the cards into four equal "hands" $hands = array_chunk($A , 4); print_r($hands); ?> </body> </html>
Output:
Previous | Home | Next |