英语翻译$cids = array_unique(explode(',',substr(str_replace(',0,',',',','.$cids),1,-1)));解释一下destoon里面一句代码谢谢

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/16 06:36:28
英语翻译$cids = array_unique(explode(',',substr(str_replace(',0,',',',','.$cids),1,-1)));解释一下destoon里面一句代码谢谢

英语翻译$cids = array_unique(explode(',',substr(str_replace(',0,',',',','.$cids),1,-1)));解释一下destoon里面一句代码谢谢
英语翻译
$cids = array_unique(explode(',',substr(str_replace(',0,',',',','.$cids),1,-1)));
解释一下destoon里面一句代码谢谢

英语翻译$cids = array_unique(explode(',',substr(str_replace(',0,',',',','.$cids),1,-1)));解释一下destoon里面一句代码谢谢
$c = str_replace(',0,', ',', ','.$cids); //将"," + $cids作为一个拼接后的字符串进行替换:",0," → ","
$b = substr($c, 1, -1); //上面操作后的结果从第一个字符起至字符串的结束作为下一步操作的输入
$a= explode(',', $b); //把上面的结果以逗号分解成若干个小子串,字串的集合作为下一步的输入
$cids=array_unique($a); //取出上一步的去重结果(移除数组中的重复的值,并返回结果数组)