Answers for "multi dimensional array to single array 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
0

php multiple array to single array

$array = array_column($array, 'plan'); 
// plan adalah nama kolom nya  
// $array adalah variable nya 
// semisal pengen membuat get data jadi single array bisa seperti ini 
     $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);
	  // print_r(array_column($query->result_array() , 'dept')); 
	  return  array_column($query->result_array() , 'dept');
Posted by: Guest on February-02-2021

Code answers related to "multi dimensional array to single array php"

Browse Popular Code Answers by Language