$a = array(0 => Array(id => 66,class_name => math),1 => Array(id => 67,class_name => linux )); $b = array(0 => Array(class_count=> 8),1 => Array(class_count => 2)); $arr = array(); foreach($a as $k=>$r){ $arr[] = array_merge($r,$b[$k]); }