I actually had a similar problem yesterday but Tig helped me out.
Try setting it to "" first, and then doing clearemptyvars();
PHP Code:
player.items.(@ temp.id) = "";
player.items.clearemptyvars();
Also, I think in your case you should make sure the .clearemptyvars() is being called on the player.items object not the player.items.(@ temp.id) object.