Hi Lorna.
Cool tip but I think I can go one better!

I have the following line in my ~/.vim/ftplugin/php.vim file

autocmd BufWritePre *.php :%s/\s\+$//e

This removes all trailing spaces in a .php file prior to writing it to disk and means I can concentrate on work rather that using macros ;-)