Replacing strings inside a specific filetype

Recently I made some spelling mistake (due to lack of knowledge) in a php project. Until I realized I had around 40 files with the typo in various places like table & function names, comments and so on.

To search for the affected files is pretty easy:

find . -type f -name "*.php" | xargs -l10 grep "tyrpo

To replace the typo as usual sed comes to the rescue:

find -type f -name "*.php" -exec sed -i 's/tyrpo/typo/' {} \;