← All built-ins / array_fill()

array_fill()

array_fill(...$args): mixed

Parameters

NameTypeDescription
$startintfirst index
$numintelement count
$valuemixedfill value

Return value

Array with $num copies of $value starting at $start.

Example

echo implode(",", array_fill(0, 3, "x"));
x,x,x

See also

array_fill_keys()array_pad()range()