array_chunk
<?php
$cards = array("jh","js","jd","jc","qh","qs","qd");
// shuffle the cards
shuffle($cards);
// Use array_chunk() to divide the cards into four equal "hands"
$hands = array_chunk($cards, 4);
print_r($hands);
?>
Related examples in the same category