When I started working with PHP I have read much of the PHP manual to see what functions were available and what they did. Furthermore I adjusted existing scripts to see what the changes resulted in. I just basically learned it by trial and error and expanded my knowledge to a level where I could create my own scripts from scratch.
Also, don't hesitate to ask anything if you're stuck with a piece of code. It's better to ask for help after trying then giving up