First of all, you need to ask your self. Do you have the prerequisites to learning PHP? Some one once told me “think of PHP as a tool that will write HTML for you.”
Here’s what that means: the web is still made of HTML. You and your browser still mostly only see HTML. PHP does its work in the back-end. In the server side.
Once you get to know PHP, this will make more sense to you.
But, since PHP is a tool to help you dynamically create HTML, you need to know HTML and CSS well before you delve into PHP. These two are definite prerequisites to PHP.
Furthermore, programming languages are kind of like spoken languages in that you may become fluent in a language and very capable of using it without really learning its grammar. However, if you don’t learn the grammar well enough, you will sooner or later make mistakes. And when you make mistakes with computers, they don’t just get confused and let it slide; they cause problems. So, I’m not gonna tell you that you need to have all the basics of Object-Oriented-Programming in order to be able to learn and use PHP proficiently, but it would help you a lot to understand objects, functions, variables and these kinds of programming basics.
So, are you ready to learn PHP?
Here’s what you need…
You need to be able to be able to execute PHP code on your local machine/PC. This will allow you to learn much faster and more conveniently.
To run PHP on your local machine, you are going to need the stuff that PHP requires, like an Apache server, maybe also MySQL database and email support…You can install each one of those individually. Or…there is an easier way!
If you are starting from a clean slate, my advice is that you download XAMPP.
Here’s why XAMPP is great for someone who wants to learn PHP:
- It’s free
- The installation process of XAMPP is idiot-proof
- Once you are done with XAMPP’s easy installation process (a couple of clicks only), you will have everything you need to run PHP on your local machine (Apache, MySQL, phpMyAdmin, Mercury Email)
- XAMPP is widely used and supported
After you have downloaded and installed XAMPP, you are ready to try PHP.
A great place for a newbie to start learning PHP (and every scripting language related to the web, including HTML and CSS) is w3Schools.com. Go through their PHP tutorial section by section. But only try to learn the basics. Don’t delve in too deep…Here’s the reason:
As a beginner, there is no reason to try to learn every single vocabulary in the language. You will overwhelm yourself and get discouraged. In the end, you are only gonna use a fraction of the entire collection of vocabulary. Therefore, only learn the minimum required to get you started. From then on, the easiest way is to learn by example. Use the sample code on w3Schools.com and all the PHP code that is freely scattered across the Web to construct solutions to your own coding challenges. Pretty soon, you will be able to make your own code from scratch. When you come across code that you don’t understand, check a few reference websites to see if the functions or coding techniques are explained. PHP.net is THE reference website for PHP. All of PHPs functions are explained there; just search for them.
Another tip: break down any programming challenge to it’s smallest piece. Then keep adding the pieces together to create your software. For example, if your programming challenge is to get PHP to take the content of a text file and output the content in an HTML table. Your first task here is how to get PHP to read the file. That’s it. Learn that first. Then learn how to store the content of the file, how to retrieve it, and how to organize it, etc.
That should be enough to get you started. If you need personal hand-holding, you might wanna visit some of the active PHP online communities and interact with the people there. A great place to start is PHP Freaks Forums.