php数组拆分合并优化

$vars['dedicatedip'] ='192.146.12.1'; $vars['assignedips'] = '192.168.12.1 192.134.12.1'; //ip与ip之间有换行符隔开 $arr3 = ''; if(!empty($vars['dedicatedip'])){ $arr =array($vars['dedicatedip']); } if(!empty($vars['assignedips'])){ $arr2 = explode(PHP_EOL,$vars['assignedips']); } if(!empty($arr) && !empty($arr2)){ $arr3 = array_merge($arr,$arr2); }elseif(!empty($arr2)){ $arr3 = $arr2; }elseif(!empty($arr1)){ $arr3 = $arr1; }

狐的传说
浏览 798回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python