php - Merge Arrays, Sort Value, Remove Duplicates and Reindex -
i have 2 separate arrays
i want merge these arrays, can't seem this.
result f1
array ( [id] => array ( [0] => 1 [1] => 2 [2] => 3 ) ) result f2
array ( [id] => array ( [0] => 2 [1] => 7 [2] => 9 ) ) final result desired
array ( [id] => array ( [0] => 1 [1] => 2 [2] => 3 [3] => 7 [4] => 9 ) ) note reindexing values numerical order.
many thanks
here's way without removing 'id' keys:
$newarray = array_merge_recursive($joinedids, $committeeids); $newarray = array_map(function($e){return array_unique($e);}, $newarray);
Comments
Post a Comment