array_fill()

Definition and Usage

The array_fill() function returns an array filled with the values you describe.

Syntax

array_fill(start,number,value)


Parameter Description
start Required. A numeric value, specifies the starting index of the key
number Required. A numeric value, specifies the number of entries
value Required. Specifies the value to be inserted



Example

<?php
$a=array_fill(2,3,"Dog");
print_r($a);
?>

The output of the code above will be:

Array ( [2] => Dog [3] => Dog [4] => Dog )
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s