Tips for learning PHP

I have been programming in PHP for a long time and to be honest I am not exactly sure when I started but I can say it has been well over ten years.  I was just thinking back to when I was first starting out with PHP and I thought if I could go back and talk to that PHP noob what advice I would give myself. It was incredibly frustrating trying to learn online back then.

Lap top with notepad and coffee
Lap top with notepad and coffee

PHP is easy. That is what I see people saying online all the time. That has always irritated me. That has always bothered me because it is incredibly misleading. I heard that when I was first starting out and it made me feel inferior when I was having trouble getting some code to do what I wanted it to do.  A hammer is easy to use. Driving a nail is easy to do. Building a house is more complicated. You see, PHP is a tool that you use to build things. Some things are easier to build than others. Moreover, easy is subjective. How easy PHP is to learn will be different for different learning styles; people; and previous programming experiences.  I have put together a list that would have helped me when I was just starting out and I hope it will help you.

Install a Local Development Environment

Installing a local development environment would have been very helpful to me in the beginning. I started with a paid hosting account to learn PHP and this was a problem for a number of reasons. First of all it eats a lot of time changing code; uploading to your remote site; and then refreshing the page to see the results. Second, it is very insecure. All of your code and mistakes are exposed to the public at large. Third, PHP does not run in a vacuum. Learning PHP also encompasses learning Apache, MySQL, and PHP. It would have been helpful to take the extra time to gain the experience of setting up a local development environment. I personally use WAMP server. WAMP is an easy to install LDE for Windows that includes PHPMyAdmin. PHPMyAdmin is a tool used to manage your MySQL databases. PHPMyAdmin is not covered in this post and neither is WAMP server. However there is a complete tutorial on WAMP here. An LDE also allows you to quickly and easily set up multiple projects if needed.

Use an IDE

I had started learning HTML first. So naturally I thought Dreamweaver, which is what I was using at the time, was an IDE. It was great for learning HTML and CSS. It showed me errors and reminded me when I did not close my tags. When it came to PHP however it did not have the code hinting or any debugging features.

The acronym IDE stands for integrated development environment. Personally, I use NetBeans. It is easy to use, full of great features and is free. IDEs vary from product to product but as a new programmer there are some features I think would have helped me.

The first feature is code completion. This means as you are typing suggestions will come up as you type. So if you are typing a function, built in PHP functions will come up as suggestions. Much the same way the auto complete works on a cell phone. NetBeans will also let you know when there is a syntax error. If you forget a closing brace or tag, NetBeans will highlight the line number with an exclamation point and tell you what the problem is.

The next feature is debugging. This allows you to set a break point in your code. When you run your program it will stop at the break point. Then you can step through your code one line at a time and see the current variables and other useful information. This would have helped me tremendously when I first started, especially when getting stuck on a problem. It allows you to see in real time what PHP is doing in memory. This feature does require that Xdebug is set up and working. That is pretty easy to do and Xdebug is included with Wamp server. See the tutorial on setting up Wamp on your local Windows machine.

Do not copy and paste code

At least don’t copy and paste code in the beginning. This may seem counter intuitive but typing out your code makes you better at typing out your code. So if you are following a tutorial, do not simply copy and paste, type it out. I know it is faster to copy and paste but trust me, once you get used to typing code you will have less errors and will become faster at it.

Start building stuff

Start building stuff as soon as possible. You will be learning things all the time and It is important to start putting that knowledge to work. If you are using a spreadsheet to track something, try and recreate that functionality in PHP and MySQL if you can. If that is too ambitious, try something smaller. It doesn’t have to be a major project you just have to keep your hands dirty.

Be Persistent

If you are new to programming you may not get every concept right away. That is normal so don’t get discouraged. I remember when I was trying to figure out object oriented PHP. I had been programming procedurally for a long time and I just could not grasp the concept of objects and how they worked (you will learn about this later). Then one day I was reading a tutorial and *Bam* the concept hit me and started to make sense.

If You Have a Question or Get Stuck, Ask

There will be times when you just seem to be stuck. It happens to the best of us and it will happen. Make sure you do your best to figure it out but if you simply cannot, ask. There are a lot of forums and resources out there for that. Heck, you can even send me an email and I may just create a tutorial on the subject.


I don’t like endorsing products but in this instance, there is a few products that I think are absolutely stellar and I think I would be doing a disservice if I didn’t recommend them.

Videos – This is one of my favorites because there are tons of things to learn there. As far as PHP is concerned, Kevin Skoglin has some outstanding classes here that I thought were pretty great. Do yourself a favor and signup with and take the courses PHP and MySQL Essential Training and PHP and MySQL beyons the basics. They are very good and you will learn a lot. I think has a free trial as well.


One of my favorite books is PHP and MySQL Web Development (5th Edition) (Developer’s Library). That is saying a lot because I have read a ton of books. As of this writing this book is on the 5th edition. This book is a monster at almost 1000 pages and it is packed with info for novices to more advanced users. I purchased this book way back on the first edition and it was a huge help to me and it is strongly recommended.

Remember, learning PHP is a marathon not a sprint. Keep moving forward and keep improving.

Related Posts