tnx litewarez but the problem is that the stupid foreach function adds each value to separate array as i wrote above.So the function is useless if it is not in one array.