I need to append the following code to the end to all the php files in a directory and its sub directory:
You can do (Work even if there's space in your file path) :
#!/bin/bash
# Create a tempory file named /tmp/end_of_my_php.txt
cat << EOF > /tmp/end_of_my_php.txt
PS: You must run the script from the directory you want to browse