How to Put
Array ( [strwarenum] = = Array ( [0] = 1 [1] = 1 ) [Strwareid] = = Array ( [0] = [1] = + ))
Converted to
Array ( [config_id] = [Strwareid] =, 78,80 [Strwarenum], [ config_name] = = [Config_desc] = [diycat_id] (=)
And can be called separately.
Reply to discussion (solution)
Set your original array to $ A, and build an empty array that you need to include all the keys $b (your example some keys are not in $ A, so build separately)
Don't know where your 78 this value comes from, temporarily when you're putting 79 wrong
I am too lazy to write the assignment part, but also to change your code, trouble, write it Yourself
foreach ($b as $k = + $v) { $a [$k][]= '; $v =array_reverse ($a [$k]);} Var_export ($b);
Self test
I'm very sorry, but I don't think
Array ( [strwarenum] = array ( [+] = 1 [+] = 1 ) [Strwareid] = = Array ( [0] = [1] [ config_id] = [ config_name] = [ Config_desc] = [diycat_id] = =)
Into
Array ( [config_id] = [Strwareid] =, 78,80 [Strwarenum], [ config_name] = = [Config_desc] = [diycat_id] (=)
$arr = your array; foreach ($arr as & $v) { if (Is_array ($v)) $v = ', '. Join (', ', $v);} Print_r ($arr);
PHP code?12345$arr= your array; foreach ($arr as & $v) {if (Is_array ($v)) $v = ', '. Join (', ', $v);} Print_r ($arr);
Thank you very much, it's settled.
$ar =array ("Strwarenum" =>array, "Strwareid" =>array (80,79)), function change ($ar) {$arr =array (); foreach ($ Ar as $key = = $value) {if ($key = = "Strwareid") {for ($i =count ($ar [$key])-1; $i >=0; $i-) {$s = $s. ",". $ar [$key] [$i];}} if ($key = = "Strwarenum") {for ($i =count ($ar [$key])-1; $i >=0; $i-) {$m = $m. ",". $ar [$key] [$i];}} $arr [' config_id ']= '; $arr [' Strwareid ']= $s; $arr [' Strwarenum ']= $m; $arr [' Config_name ']= '; $arr [' Config_desc ']= '; $arr [' diycat_id ']= '; return $arr;} echo "";p Rint_r (Change ($ar)); echo"
"; Array ( [config_id] = [Strwareid] =, 79,80 [Strwarenum] =, [ config_name] = [ CONFIG_DESC] = [diycat_id] = =)
Uh, there's a connection? Does the value of Strwarenum key and Strwareid correspond? Give two different strwarenum values to see what the results are.
In addition, you give the data can be written in the definition of the form ah "strwarenum" = = Array ..., but also I have to change it?!
Actually knot the ... If there is a correspondence, the above buildings, including the one I wrote, can't be used.
PHP code?123456789101112131415161718192021222324252627282930313233343536 $ar =array ("Strwarenum" =>array), " Strwareid "=>array (80,79)); function Change ($ar) {$arr =array (...).
In fact Strwarenum is the number can not be considered. corresponding to each Strwareid 1 can also be
Strwareid is the main function to get