I'm sure that this..
PHP Code:
temp.array = {};
..empties the array, if that's what you want.
Edit: Your last script doesn't work because you are trying to use the add() function although it does not exist. Careful, this only works on arrays. Neither temp.obj nor temp.obj2 is an array in your script.