Answers for "convert multidimensional array to 1d php"

PHP
0

convert multidimensional array into single dimension php

$arrayMult = [ ['a','b'] , ['c', 'd'] ];
$arraySingle = call_user_func_array('array_merge', $arrayMult);
// $arraySingle is now = ['a','b', 'c', 'd'];
Posted by: Guest on April-21-2021
2

convert multidimensional array to single array php

$singleArray = []; 
foreach ($parentArray as $childArray) 
{ 
    foreach ($childArray as $value) 
    { 
    $singleArray[] = $value; 
    } 
}
Posted by: Guest on October-13-2020

Code answers related to "convert multidimensional array to 1d php"

Browse Popular Code Answers by Language