比如
$a='第001|||52第002|||40第003|||40第004|||44第005|||38第006|||40第007|||40第008|||40第009|||40第010|||36第011|||40第012|||40';$b='10362/00110362/00210362/00310362/00410362/00510362/00610362/00710362/00810362/00910362/01010362/01110362/012';
组装数组咯 以$a的值作为键,$b作为值。。没试验过~
组装数组咯 以$a的值作为键,$b作为值。。没试验过~
$a='第001|||52第002|||40第003|||40第004|||44第005|||38第006|||40第007|||40第008|||40第009|||40第010|||36第011|||40第012|||40';$b='10362/00110362/00210362/00310362/00410362/00510362/00610362/00710362/00810362/00910362/01010362/01110362/012';$a1 = preg_split("/[\r\n]+/", trim($a));$b1 = preg_split("/[\r\n]+/", trim($b));print_r(array_combine($a1, $b1));//或print_r(array_map(null, $a1, $b1));
Array( [第001|||52] => 10362/001 [第002|||40] => 10362/002 [第003|||40] => 10362/003 [第004|||44] => 10362/004 [第005|||38] => 10362/005 [第006|||40] => 10362/006 [第007|||40] => 10362/007 [第008|||40] => 10362/008 [第009|||40] => 10362/009 [第010|||36] => 10362/010 [第011|||40] => 10362/011 [第012|||40] => 10362/012)Array( [0] => Array ( [0] => 第001|||52 [1] => 10362/001 ) [1] => Array ( [0] => 第002|||40 [1] => 10362/002 ) [2] => Array ( [0] => 第003|||40 [1] => 10362/003 ) [3] => Array ( [0] => 第004|||44 [1] => 10362/004 ) [4] => Array ( [0] => 第005|||38 [1] => 10362/005 ) [5] => Array ( [0] => 第006|||40 [1] => 10362/006 ) [6] => Array ( [0] => 第007|||40 [1] => 10362/007 ) [7] => Array ( [0] => 第008|||40 [1] => 10362/008 ) [8] => Array ( [0] => 第009|||40 [1] => 10362/009 ) [9] => Array ( [0] => 第010|||36 [1] => 10362/010 ) [10] => Array ( [0] => 第011|||40 [1] => 10362/011 ) [11] => Array ( [0] => 第012|||40 [1] => 10362/012 ))
$a='第001|||52第002|||40第003|||40第004|||44第005|||38第006|||40第007|||40第008|||40第009|||40第010|||36第011|||40第012|||40';$b='10362/00110362/00210362/00310362/00410362/00510362/00610362/00710362/00810362/00910362/01010362/01110362/012';$a1 = preg_split("/[\r\n]+/", trim($a));$b1 = preg_split("/[\r\n]+/", trim($b));print_r(array_combine($a1, $b1));//或print_r(array_map(null, $a1, $b1));
Array( [第001|||52] => 10362/001 [第002|||40] => 10362/002 [第003|||40] => 10362/003 [第004|||44] => 10362/004 [第005|||38] => 10362/005 [第006|||40] => 10362/006 [第007|||40] => 10362/007 [第008|||40] => 10362/008 [第009|||40] => 10362/009 [第010|||36] => 10362/010 [第011|||40] => 10362/011 [第012|||40] => 10362/012)Array( [0] => Array ( [0] => 第001|||52 [1] => 10362/001 ) [1] => Array ( [0] => 第002|||40 [1] => 10362/002 ) [2] => Array ( [0] => 第003|||40 [1] => 10362/003 ) [3] => Array ( [0] => 第004|||44 [1] => 10362/004 ) [4] => Array ( [0] => 第005|||38 [1] => 10362/005 ) [5] => Array ( [0] => 第006|||40 [1] => 10362/006 ) [6] => Array ( [0] => 第007|||40 [1] => 10362/007 ) [7] => Array ( [0] => 第008|||40 [1] => 10362/008 ) [8] => Array ( [0] => 第009|||40 [1] => 10362/009 ) [9] => Array ( [0] => 第010|||36 [1] => 10362/010 ) [10] => Array ( [0] => 第011|||40 [1] => 10362/011 ) [11] => Array ( [0] => 第012|||40 [1] => 10362/012 ))
$a='第001|||52第002|||40第003|||40第004|||44第005|||38第006|||40第007|||40第008|||40第009|||40第010|||36第011|||40第012|||40';$b='10362/00110362/00210362/00310362/00410362/00510362/00610362/00710362/00810362/00910362/01010362/01110362/012';$a1 = preg_split("/[\r\n]+/", trim($a));$b1 = preg_split("/[\r\n]+/", trim($b));print_r(array_combine($a1, $b1));//或print_r(array_map(null, $a1, $b1));
Array( [第001|||52] => 10362/001 [第002|||40] => 10362/002 [第003|||40] => 10362/003 [第004|||44] => 10362/004 [第005|||38] => 10362/005 [第006|||40] => 10362/006 [第007|||40] => 10362/007 [第008|||40] => 10362/008 [第009|||40] => 10362/009 [第010|||36] => 10362/010 [第011|||40] => 10362/011 [第012|||40] => 10362/012)Array( [0] => Array ( [0] => 第001|||52 [1] => 10362/001 ) [1] => Array ( [0] => 第002|||40 [1] => 10362/002 ) [2] => Array ( [0] => 第003|||40 [1] => 10362/003 ) [3] => Array ( [0] => 第004|||44 [1] => 10362/004 ) [4] => Array ( [0] => 第005|||38 [1] => 10362/005 ) [5] => Array ( [0] => 第006|||40 [1] => 10362/006 ) [6] => Array ( [0] => 第007|||40 [1] => 10362/007 ) [7] => Array ( [0] => 第008|||40 [1] => 10362/008 ) [8] => Array ( [0] => 第009|||40 [1] => 10362/009 ) [9] => Array ( [0] => 第010|||36 [1] => 10362/010 ) [10] => Array ( [0] => 第011|||40 [1] => 10362/011 ) [11] => Array ( [0] => 第012|||40 [1] => 10362/012 ))
你要按什么格式输出?
你要按什么格式输出?
foreach(array_combine($a1, $b1) as $k=>$v) $r[] = "$k>>>>>>>$v";echo join(PHP_EOL, $r);//或echo join(PHP_EOL, array_map(function($a, $b) {return "$a>>>>>>>$b";}, $a1, $b1));