PHP Manual
Prev |  | Next

# array_fill

(PHP 4 CVS only)

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:

    $a[5]  = "banana";
    $a[6]  = "banana";
    $a[7]  = "banana";
    $a[8]  = "banana";
    $a[9]  = "banana";
    $a[10] = "banana";
    */

Prev | Home | Next
array_flip | Up | array_intersect