array_pad

It pads array to the specified length with a value

Example

<?php
echo “<pre>”;
$array1 = array(2, 4,1, 3);
$array2 = array_pad($array1, 5, 0);
print_r($array2);
?>

Output

Array
(
[0] => 2
[1] => 4
[2] => 1
[3] => 3
[4] => 0
)


Share