W3Schools.com

PHP array_fill() Function


PHP Array Reference Complete PHP Array Reference

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 )


PHP Array Reference Complete PHP Array Reference
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE