With a solid grounding in HTML and CSS, I needed a little bit of JavaScript and a little bit of PHP. I found PHP more difficult to get into than JavaScript, at least in part because my need for JavaScript was mostly in the form of small, self-contained programs. My use for PHP was for code that would pervade the page, and to modify larger-scale programs written by others. On top of that, I had a lot of trouble finding PHP tutorials online – it would be nice if you could tell Google that file extensions shouldn’t qualify as hits. I got better results when I typed “best way to learn PHP” (with the quotation marks) into the search bar, and later by looking for PHP game tutorials. As a consequence I actually have more to say about learning PHP than JS at this point.
If I were to start fresh but knowing the resources I do now, I would begin with the Codecademy PHP track. Although it feels like you’re invading a seventh grade computing class with a teacher who’s trying too hard to be hip, it is interactive and gets you actually typing commands right away. After that, well, it depends on your best learning style, but I would turn to PHP Exercises for structure and fill in the necessary knowledge to solve the exercises from a variety of sources. The tutorial series at Home and Learn also has exercises, but a possibility of out of date material (its age is given away by the all-caps HTML). Either way, to learn how to solve the exercises there are tutorial series at IBM developerWorks and tizag.com, plus the online book Practical PHP Programming. You’ll find a long series of short PHP tutorial videos at Bucky’s Room (I know, the name does not inspire confidence, but the ones I’ve watched have been quite good).
Once you have a firm foundation and a project, you can start looking up specific things you need. For me this included Lynda.com courses like Validating and Processing Forms with JavaScript and PHP and Accessing Databases with Object-Oriented PHP. PHP Freaks seems to be dead, but has a lot of good tutorials in its archives, and you’ll find PHP among the CSS-Tricks code snippets.
I was not ready to use it right away, but now I am a big fan of the official PHP documentation. Of course it’s very useful for looking up specific functions and so forth, but it’s more than that: the up- and down-voted comment section is regularly a helpful supplement and occasionally the best part of the page. For example, there’s a comment giving a regex cheat sheet on the preg_match page, and comments giving functions for searching multidimensional arrays on the array_search page. At some point I would like to go through the manual, find the pages that read more like tutorials, and create a directory for them.
Stack Overflow is of course a good place to look for specific questions. PHP Developers Network also has an active forum. There’s also a page called PHP: The Right Way, which is sometimes given in replies to requests for PHP tutorials. It’s a master class if it’s a tutorial at all, but can be good reading for best practices.
Finally, for completeness: though the organization is (so far) unintuitive to me – e.g., INSERT is in Data Manipulation instead of Data Creation – if your uses for PHP are like mine, you will at some point want the online MySQL documentation, for whatever version of MySQL your server stack uses (found in phpInfo).
Studious dog from JanDix on Pixabay.