<?php$a1 = '10,20,30,40;1,2,3,4';//分号无限往后扩展$a = explode(';', $a1);$b1 = '11111;22222';//分号无限往后扩展,能与$a1对齐叠加$b = explode(';', $b1);print_r($a);print_r($b);?>
$a1 = '10,20,30,40;1,2,3,4';//分号无限往后扩展$a = explode(';', $a1);$b1 = '11111;22222';//分号无限往后扩展,能与$a1对齐叠加$b = explode(';', $b1);$c = array_map(null, $a, $b);print_r($c);
Array( [0] => Array ( [0] => 10,20,30,40 [1] => 11111 ) [1] => Array ( [0] => 1,2,3,4 [1] => 22222 ))
$a1 = '10,20,30,40;1,2,3,4';//分号无限往后扩展$a = explode(';', $a1);$b1 = '11111;22222';//分号无限往后扩展,能与$a1对齐叠加$b = explode(';', $b1); $c=array();foreach($a as $key=>$value){ $c[]=$value.",".$b[$key];}echo '<pre class="brush:php;toolbar:false">';print_r($c);
$a1 = '10,20,30,40;1,2,3,4';//分号无限往后扩展$a = explode(';', $a1);$b1 = '11111;22222';//分号无限往后扩展,能与$a1对齐叠加$b = explode(';', $b1);function combine($arr){ return implode(',',$arr);}$c = array_map('combine', array_map(null, $a, $b));print_r($c);
ご回答いただきありがとうございます。問題が解決しました!