Home > Backend Development > PHP Tutorial > php-Arrays function-array_fill-fills an array with a given value_PHP tutorial

php-Arrays function-array_fill-fills an array with a given value_PHP tutorial

WBOY
Release: 2016-07-13 17:51:17
Original
1512 people have browsed it

array_fill() function fills an array with the given value

【Function】
This function will return a new array,
The array is filled with the specified amount of the specified content.
【Scope of use】
            php4 > 4.2.0, php5.
【Use】
array array_fill( int start_index, int num, mixed value )
           start_index/required/the starting number of key names in the new array
                                                                                                                                                                                                num/Required/ is the number of items to be filled in the new array. This value must be a value greater than zero, otherwise php will issue a warning
value/required/is the value in the new array
【Example】
[php]
print_r( array_fill( 5, 6, "hehe" ) );
/*
Array
(
[5] => hehe
[6] => hehe
[7] => hehe
[8] => hehe
[9] => hehe
[10] => hehe
)
*/


Excerpted from zuodefeng’s notes

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478204.htmlTechArticlearray_fill() function fills the array with the given value [Function] This function will return a new array, the The array is filled with the specified amount of the specified content. 【Scope of use】php4...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template