Home >Backend Development >PHP Tutorial > php 数组的防止重复,key value的用法,拼凑,拆分的用法

php 数组的防止重复,key value的用法,拼凑,拆分的用法

WBOY
WBOYOriginal
2016-06-13 12:33:15865browse

php 数组的防止重复,key value的用法,拼接,拆分的用法

??????? foreach($a as $key=>$val){//key 为数组$a 下标?? $val为$a的值
??????????? $val = array_unique($val);//这个是防止数组$val重复的
??????????? $insertDate = array(//设置新的数组
??????????????? 'ini_id' => $key,//数组下标'ini_id'
??????????????? 'door_id'=>implode(',',$val)//拼接$a数组的值? explode是拆分
??????????? );

Statement:
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