PHP 数组的值插入
2020-12-13 16:27
阅读:390
标签:class ext com os cti for
曾今写过一个坑货的数组方法
function array_insert($myarray,$value,$position=0)
{
$fore=($position==0)?array():array_splice($myarray,0,$position);
$fore[]=$value;
$ret=array_merge($fore,$myarray);
return $ret;
}
此函数用法
返回一个数组,内容是在$myarray数组的$position处插入$value
例如
$a=array("a", "b","c", "d");
$a=array_insert($a,"add",3);
print_r($a); //Array ( [0] => a [1] => b [2] => c [3] => add [4] => d )
PHP 数组的值插入,搜素材,soscw.com
PHP 数组的值插入
标签:class ext com os cti for
原文地址:http://www.cnblogs.com/sunxun/p/3799919.html
评论
亲,登录后才可以留言!