Find all files with the extension ".php" in the current directory and its subdirectories, and count the number of occurrences of the string "$string" in each file.
find . -iname "*.php" -exec egrep -c '$string' {} \;