Search the directory /usr/local/ for any files ending with .php, and for each of those files, execute the command "sed -i 's/foo/bar/g' {}", where {} is the file name.
find /usr/local/ -name '*.php' -exec sed -i 's/foo/bar/g' {} \;