array_pad < PHP
The array_pad function pads an array to the specified length with a value.
$numbers = array(12, 10, 9);
$numbersPad = array_pad($numbers, 5, 0);
print_r($numbersPad);
// Array
//(
// [0] => 12
// [1] => 10
// [2] => 9
// [3] => 0
// [4] => 0
//)
$numbersPad = array_pad($numbers, -5, 1);
print_r($numbersPad);
// Array
//(
// [0] => 1
// [1] => 1
// [2] => 12
// [3] => 10
// [4] => 9
//)