The problem:
On my webspace there are PHP files which all end with this:
Before
Who are you hosted with? Some hosters have security leaks that can get exploited.
Are you using WordPress? There's also been an number of reported outbreaks. The best thing to do would be google it looking for people with similar problems, which will also lead to the cause, which will lead to the solutions.