php as such is open source or at least free isn't it? So all you need is an editor with a Syntax Highlighting feature so you can see what you're doing. If everything starting in the middle of line 3 is purple, you've left something out.
Depending on your computer and OS, you may already have some version of php hiding somewhere. And they throw in another copy with MAMP and WAMP.
If you're on shared hosting find out what version of php they use. Make sure you're not writing your code in a newer version than what the host has. (Older shouldn't be a problem.)