PHP array_fill() Function
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 )
|
Complete PHP Array Reference
|
|
Get Your Diploma!
W3Schools' Online Certification Program is the perfect solution for busy
professionals who need to balance work, family, and career building.
The HTML Certificate is for developers who want to document their knowledge of HTML, XHTML, and CSS.
The JavaScript Certificate is for developers who want to document their knowledge of JavaScript and the HTML DOM.
The XML Certificate is for developers who want to document their knowledge of XML, XML DOM and XSLT.
The ASP Certificate is for developers who want to document their knowledge of ASP, SQL, and ADO.
The PHP Certificate is for developers who want to document their knowledge of PHP and SQL (MySQL).
|
|