PHP Manual
Prev |  | Next

# array_fill

(PHP 4 >= 4.2.0)

array_fill -- Fill an array with values

## Description

array array_fill ( int start_index, int num, mixed value)

array_fill() fills an array with `num` entries of the value of the `value` parameter, keys starting at the `start_index` parameter.

Example 1. array_fill() example
    $a = array_fill(5, 6, 'banana');
$a now has the following entries using print_r():
    Array
    (
        [5]  => banana
        [6]  => banana
        [7]  => banana
        [8]  => banana
        [9]  => banana
        [10] => banana
    )

Prev | Home | Next
array_diff | Up | array_filter