convert multidimensional array to single array php
$singleArray = [];
foreach ($parentArray as $childArray)
{
foreach ($childArray as $value)
{
$singleArray[] = $value;
}
}
convert multidimensional array to single array php
$singleArray = [];
foreach ($parentArray as $childArray)
{
foreach ($childArray as $value)
{
$singleArray[] = $value;
}
}
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');
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us