This post is meant to provide a blueprint on the best way to learn the ins and outs of PHP. I’ve been developing with PHP for around 10 years now, and with a personality that craves knowledge, I’ve been growing as a developer each year (even looking back at some of my old posts four years ago I cringe). IT is a fast paced industry: you should never stagnate your learning, and should instead always be looking towards self improvement. Even if you think you’ve mastered a particular technology, look at it objectively and ask yourself what you could do to make yourself a better developer?
Drawing on my experience with PHP, I’ve created the following blueprint for what I consider to be important factors in developing your skills in PHP from a beginner to advanced level, and some areas to consider once you’ve hit that final stage.
If you’re brand new to PHP (and possibly web programming), I’d recommend the following:
Learning the basics of HTML/CSS/JS
Even though I prefer backend PHP development (meaning I prefer writing the code behind the web interface and not the interface itself), I wouldn’t ever have been able to come this far without being very familiar with the major frontend technologies. Nowadays, a web developer must be fluent and comfortable with HTML5, CSS3 and JS (this includes being familiar with most of the major JS frameworks, most importantly jQuery).
A good exercise to start familiarising yourself with these technologies is to create a simple website using only frontend technologies from a .png/.psd/.pdf file. I’d head over to Themeforest and consider purchasing some of their .psd files. They’re generally quite modern, and if you can easily create those using best practices you should be alright (don’t forget to validate your work with the w3 validator).
Learning the basics of PHP
After familiarising yourself with some of the frontend technologies, you should be able to start learning PHP. In my opinion, the best way to do this is by getting your hands dirty: follow some tutorials and start building. After having followed those tutorials to a point where you’re relatively comfortable, you should start building some simple websites (I wouldn’t publish these websites, as there is a very high chance they’re rife with security vulnerabilities. I’d instead use it as a learning tool). The more code you write, the more information you’ll retain.
At this stage, my biggest stress would be to write your own code! This may sound counter intuitive, particularly with all of the libraries out there. However, early on, you’re going to run in to a myriad of different problems. The simple solution would be to copy and paste someone else’s code without considering how it works. This is a trap you should never fall in to. One of the most effective ways of learning is to run in to a problem, and by spending time researching and solving the problem, it ensures you won’t ever run in to it again.
At this stage I wouldn’t worry too much about best practices, unless you’re coming from another language that you’re comfortable with. If PHP is your first attempt at learning a programming language, just get in there until you feel comfortable writing code and building simple applications. Moreover, I wouldn’t get too attached to any code you write. Most of the code you write at the start of your learning will be rubbish when you look back on it later. Instead of re-using the same code over and over, it may be worthwhile to instead rewrite it with the new knowledge you’ve learnt. Chances are, it’ll be a lot better the second time.
If you’ve come this far, you should be able to comfortable build applications written in spaghetti code, which is simply a term coined by developers to symbolise code that’s a horrible mess. I know a lot of developers who pique at this stage in their development. As far as they’re concerned, the applications they’re building works, hence the structure and elegance of the code behind the application is secondary. This is a fine mentality for a simple hobbyist, however if you’re looking to make a career out of PHP, or simply want to continue furthering your development, please note that there is significant improvement still ahead.
Continue on to Learning PHP: A blueprint to become a better programmer.