array_pad 3
<?php
$dogs = array('A' => 'AA', 'Bud' => 'BB','C' => 'D');
$pups = array_pad($dogs, 6, 'mutt');
printf("<p>Pups:</p><pre>%s</pre>\n", var_export($pups, TRUE));
$pups = array_pad($dogs, -6, 'mutt');
printf("<p>Pups:</p><pre>%s</pre>\n", var_export($pups, TRUE));
printf("<p>Dogs:</p><pre>%s</pre>\n", var_export($dogs, TRUE));
?>
Related examples in the same category