Renaming file extensions with bash script

A couple of weeks ago I had to rename the file extension of several view scripts from html (from my own mvc framework) to phtml (zend framework). I found, as always, bash to be my friend.

for i in *
do
  ( file $i | grep html ) && mv $i $(echo $i | sed s/html$/phtml/)
done