1) $0is the name of the executable file (the script in your case, for example: if your script is called start_me, then $0is start_me)
2) ERR=$?receives a return codenice php -q -f ./data.php -- $@
3) -- $@ , , php, data.php $@ script ./data.php (, ./your_script_name foo bar nice php -q -f ./data.php -- foo bar)
4) , script
YOUR_FILE=$1
shift
nice php -q -f ./$YOUR_FILE -- $@