In the form I have INPUT array name=INPUT_1[]..
that are dynamic, cloned added other values. In the example below each INPUT
has 2 values, plus there may be several!
Note: 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'd like to treat the array above for:
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
)
Attempt
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 you're only getting the last values of each array:
Array
(
[INPUT_1] => 113
[INPUT_2] => 224
[INPUT_3] => 335
[INPUT_4] => 446
[INPUT_5] => 557
)