- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
array_fill() function in PHP
The array_fill() function is used to fill an array with values. It returns the filled array. It returns the filled array.
Syntax
array_fill(start_index, num, value)
Parameters
start_index − First index of the returned array. Required.
num − The count of elements to insert. Required.
value − The value that would fill the array. Required.
Return
The array_fill() function returns the filled array.
Example
<?php $a = array_fill(3, 5, 'demo'); print_r($a); ?>
Output
Array ( [3] => demo [4] => demo [5] => demo [6] => demo [7] => demo )
Advertisements