a::fill($array, $limit, $fill = 'placeholder')

Fills an array up with additional elements to certain amount.

  • $array (array)
    The source array
  • $limit (int)
    The number of elements the array should contain after filling it up.
  • $fill (mixed)
    The element, which should be used to fill the array
  • return (array)
    The filled-up result array


$array = array(

$result = a::fill($array, 5, 'elephant');



array (size=5)
  0 => string 'cat' (length=3)
  1 => string 'dog' (length=3)
  2 => string 'bird' (length=4)
  3 => string 'elephant' (length=8)
  4 => string 'elephant' (length=8)

Is something missing or incorrect? Edit this page on Github…