1
In the form I have INPUT array name=INPUT_1[]..
which are dynamic, cloned added other values. In the example below each INPUT
has 2 values, but there can be several!
Obs: PHP 5.3.8
When submitting the form I have the Array.
Array (
[INPUT_1] => Array
(
[0] => 74
[1] => 69
)
[INPUT_2] => Array
(
[0] => 45
[1] => 1
)
[INPUT_3] => Array
(
[0] => 5
[1] => 2
)
[INPUT_4] => Array
(
[0] => 88
[1] => 3
)
[INPUT_5] => Array
(
[0] => 123.389,89
[1] => 12,33
)
)
In my PHP, I would like to treat the array above to:
Array (
[INPUT_1] => 74,
[INPUT_2] => 45,
[INPUT_3] => 5,
[INPUT_4] => 88,
[INPUT_5] => 123.389,89
)
Array (
[INPUT_1] => 69,
[INPUT_2] => 1,
[INPUT_3] => 2,
[INPUT_4] => 3,
[INPUT_5] => 12,33
)
Trying
Guys I’m trying to:
$array = array(
'INPUT_1' => array(111, 112, 113),
'INPUT_2' => array(222, 223, 224),
'INPUT_3' => array(333, 334, 335),
'INPUT_4' => array(444, 445, 446),
'INPUT_5' => array(555, 556, 557)
);
$out = array();
foreach($array as $nome => $arr) {
foreach($arr as $key => $value) {
$out[$nome] = $value;
}
}
but only getting the last values of each array:
Array
(
[INPUT_1] => 113
[INPUT_2] => 224
[INPUT_3] => 335
[INPUT_4] => 446
[INPUT_5] => 557
)
served no friend :(
– smigol
@smigol What did not serve, what is the error? the array is different?
– abfurlan
its example ta limited 2 columns, the values within the INPUT array is dynamic, there may be several
– smigol
@smigol see if the issue meets.
– abfurlan
now it got show! Thank you old man.
– smigol