Convert multiple arrays into strings. at the end of this post, mail163lc is used to edit the array $ aArray & nbsp; (& nbsp; [0] & nbsp; & gt; & nbsp; 1 & nbsp; [1] & nbsp; & gt; & nbsp; 2 & nbsp;) & nbsp; $ bArray & nbsp; (& nbsp; [0] & nbsp; & convert multiple arrays into strings
This post was last edited by mail163lc at 11:55:19
Array
$a=Array ( [0] => 1 [1] => 2 )
$b=Array ( [0] => 1 [1] => 2 )
$c=Array ( [0] => 128 [1] => 108 )
$d=Array ( [0] => 128 [1] => 216 )
String to be converted
$ E = 1 | 1 | 128 | 128 | ~ 2 | 2 | 108 | 216
The array may also contain
$a=Array ( [0] => 1 [1] => 2 [2] => 3 )
$b=Array ( [0] => 1 [1] => 2 [2] => 2 )
$c=Array ( [0] => 128 [1] => 108 [2] => 420 )
$d=Array ( [0] => 128 [1] => 216 [2] => 840 )
The conversion result requires programming.
$ E = 1 | 1 | 128 | 128 | ~ 2 | 2 | 108 | 216 | ~ 3 | 2 | 420 | 840
------ Solution --------------------
$ A = Array (0 => 1, 1 => 2, 2 => 3 );
$ B = Array (0 => 1, 1 => 2, 2 => 2 );
$ C = Array (0 => 128, 1 => 108, 2 => 420 );
$ D = Array (0 => 128, 1 => 216, 2 => 840 );
Echo foo ($ a, $ B, $ c, $ d );
Function foo (){
Foreach (func_get_args () as $ t ){
Foreach ($ t as $ I => $ v)
$ R [$ I] [] = $ v;
}
Foreach ($ r as $ I => $ v)
$ R [$ I] = join ('
------ Solution --------------------
', $ V );
Return join ('
------ Solution --------------------
~ ', $ R );
}
1
------ Solution --------------------
1
------ Solution --------------------
128
------ Solution --------------------
128
------ Solution --------------------
~ 2
------ Solution --------------------
2
------ Solution --------------------
108
------ Solution --------------------
216
------ Solution --------------------
~ 3
------ Solution --------------------
2
------ Solution --------------------
420
------ Solution --------------------
840