Go to directory that contain files.
Find all PHP files in that folder & replace string
bar in all files.
find . -name "*.php" -print | xargs sed -i 's/foo/bar/g'
Do you need any help on Linux & Linux Commands? I'm happy to help you.