How to rename files in a directory using bash script

view story

http://stackoverflow.com – I wanted to find a bash script for renaming files with _ (underscore) to - (hyphen) for example changing file name my_page_name.php to my-page-name.php, keeping the name of the file of those without .php extension same I attempted: Nothing yet , just used the script found here bbs.archlinux.org/viewtopic.php?id=36305 and replace space with _ and underscore with - (HowTos)