convert single array to multidimensional array php code example
Example 1: convert multidimensional array into single dimension php
$arrayMult = [ ['a','b'] , ['c', 'd'] ];
$arraySingle = call_user_func_array('array_merge', $arrayMult);
Example 2: convert multidimensional array to single array php
$singleArray = [];
foreach ($parentArray as $childArray)
{
foreach ($childArray as $value)
{
$singleArray[] = $value;
}
}
Example 3: multidimensional array in php
<?php
$carsModel = array
(
array("Maruti",21,28),
array("BMW",05,75),
array("Tata",25,12),
array("Land Rover",11,20)
);
?>