Is there any possibility to explode values of an array to create direct a new array with these values. I'm able to do this only with a intemidiate step.
I have following array:
Array (
[0] => OtherMachines, Polymers
[1] => Engines/Pumps/Turbines, Measurement
[2] => Materials/Metallurgy
[3] => Materials/Metallurgy, ThermProcesses
)
Then I explode its values:
foreach ($array00 as $v) {
$array01 = explode(", ", $v);
}
and receive following array:
Array
(
[0] => Array
(
[0] => OtherMachines
[1] => Polymers
)
[1] => Array
(
[0] => Engines/Pumps/Turbines
[1] => Measurement
)
[2] => Array
(
[0] => Materials/Metallurgy
)
[3] => Array
(
[0] => Materials/Metallurgy
[1] => ThermProcesses
)
)
Than I have to flatten the array to get the one I wish:
// Flatten the array.
$array02 = call_user_func_array('array_merge', $array01);
Final result:
Array (
[0] => OtherMachines
[1] => Polymers
[2] => Engines/Pumps/Turbines
[3] => Measurement
[4] => Materials/Metallurgy
[5] => Materials/Metallurgy
[6] => ThermProcesses
)
Is there any way to do this direct?
Many thanks in advance.