PHP头条
热点:

php-Arrays函数-array_fill-用给定的值填充数组


array_fill() 函数 用给定的值填充数组

【功能】
         该函数将返回一个新的数组,
         该数组用被指定的数量的指定内容填充。
【使用范围】
         php4 > 4.2.0、php5.
【使用】
         array array_fill( int start_index, int num, mixed value )
         start_index/必需/新数组中键名的开始数
         num/必需/为新数组填充的个数,该值必须是一个大于零的值,否则php会发出一条警告
         value/必需/为新数组中的值
【示例】
[php]
<?php 
print_r( array_fill( 5, 6, "hehe" ) ); 
/*
Array
(
    [5] => hehe
    [6] => hehe
    [7] => hehe
    [8] => hehe
    [9] => hehe
    [10] => hehe
)
*/ 

 


摘自 zuodefeng的笔记

www.phpzy.comtrue/phprm/16602.htmlTechArticlephp-Arrays函数-array_fill-用给定的值填充数组 array_fill() 函数 用给定的值填充数组 【功能】 该函数将返回一个新的数组, 该数组用被指定的数量的指定内容填充。 【使用范围】 php4 4.2....

相关文章

    暂无相关文章

PHP之友评论

今天推荐