turn multidimensional array into single array code example
Example 1: convert multidimensional array to single array php
$singleArray = [];
foreach ($parentArray as $childArray)
{
foreach ($childArray as $value)
{
$singleArray[] = $value;
}
}
Example 2: php multiple array to single array
$array = array_column($array, 'plan');
$CI = get_instance();
$DB1 = $CI->load->database('nama_db', TRUE);
$sql = "select dept from v_dept_distinct order by dept asc ";
$query=$DB1->query($sql);
return array_column($query->result_array() , 'dept');