Learning PHP for beginners step by step. What you should know before watching this course. Before we start, let’s take a look at what you’ll need to follow this course starting with who this course is for. This is a beginner’s course. You need absolutely no experience of PHP or of programming.
But don’t let that put you off if you’ve already dabbled with code. I intend to keep the theory short and focus on getting things done. However you should have a good knowledge of HTML.
Although I won’t be using a lot of HTML in the early part of the course, PHP is most commonly used to generate webpages. If you try to mix PHP and HTML without really understanding the HTML, you’ll end up with a mess.
If you’re impatient to get started, you might wonder why I’m telling you to spend time setting up a local server. First of all, it’s much quicker. You don’t need to keep uploading your files every time you make a change. In the early days, you’ll likely to make mistakes so working locally avoids exposing your mistakes in public. Even when you become more experienced, you’ll appreciate being able to develop offline in your local testing environment. David Gassner’s course, Installing Apache, MySQL and PHP here on lynda.com will guide you through the setup process.
There are several all-in-one packages that handle everything automatically. What’s more, they’re free. The other essential requirement is a script editor. PHP is written in plain text like HTML and CSS so any text editor will do. However you’ll find writing PHP scripts much easier if the editor has the following features: A PHP syntax checker to make it easy to spot mistakes in your code.
Syntax coloring to highlight the different parts of the language, this also helps identify mistakes. Code hints to remind you of how to use builtin and custom functions. Line numbering, and a feature to identify matching opening and closing braces, brackets and parentheses. During this course, I’ll be using a commercial program called phpstorm 9, but it doesn’t matter what you use. If you need advice on choosing a PHP editor, check out Joe Lowery’s course here on lynda.com.
He looks at a wide range of options including free editors that are suitable for writing PHP scripts. It doesn’t matter which operating system you’re using. PHP is completely platform neutral. Most PHP websites run on Linux servers, but PHP runs equally well on Mac OS X and Windows. I recorded this course on a Mac, but I’ve also tested the code on Windows and Linux, it runs exactly the same in each operating system.
A quick word about PHP versions: This course is based on PHP 7.0, but it’s not exclusively PHP 7 course. The great thing about PHP 7 is that with very few exceptions, it’s backwards compatible with older versions. PHP 6 was never released publicly so many websites are likely to continue running on PHP 5 possibly for several years. My recommendation is that PHP 5.5 should be the minimum version you should be running.
Official support for PHP 5.4 ended in September 2015. Having said that, the overwhelming majority of the code in this course will run on PHP 5.4. I’ll always make it clear where a later version of PHP is required and I’ll offer a workaround for PHP 5.4. There’s just one final requirement for this course, patience. Like all programming languages, PHP is intolerant of mistakes, and you’ll bound to make them while learning.
It can be frustrating when you don’t understand why your code doesn’t work, but I’ll try to point out common pitfalls to help you troubleshoot problems. And take heart from this: even experienced programmers make mistakes, the only difference, is that the experienced programmer can usually spot the error more quickly. And with patience, you’ll learn to do the same.