How to remove the parent numeric keys of php array -


i've array in php below

array (     [0] => array         (             [0] => 40173             [1] => 514081             [2] => 363885             [3] => 891382         ),     [1] => array         (             [0] => 40173             [1] => 5181             [2] => 385             [3] => 891382         )  ) 

now want remove parents indexes 0,1... , want values (only unique values).

thanks.

one possible approach using call_user_func_array('array_merge', $arr) idiom flatten array, extracting unique values array_unique():

$new_arr = array_unique(   call_user_func_array('array_merge', $old_arr)); 

demo. obviously, it'll work array of length.


Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -