PHP 101

This section is meant as an introduction to PHP for absolute beginners. If you’re interested in learning PHP or need a quick refresher on basic PHP this would be a great place to start. I will try to keep this section up-to-date with some helpful tutorials and perhaps a few tips and tricks on learning PHP. PHP 101 Tutorial

So if you’re just looking to get started, and jump right in, here are the foundations you need first:

In each of these tutorials I will attempt to highlight the most important points that you should try to grasp, first, with context and examples. I will also try to include direct links to the PHP documentation, where possible, so that you can read the actual documented behavior in more detail.

Please note that these tutorials only serve as a guiding point and that the manual should always be your primary point of reference when trying to understand PHP’s documented behavior.

PHP 101 Table of Contents

  • Introduction — PHP Intro
    • This is an introduction to what PHP is, how it’s installed, and a little of what it can do.
  • Chapter 1 — PHP Syntax
    • Learn about fundamental PHP syntax like expressions, operators, and statements.
  • Chapter 2 — PHP Constructs
    • Learn about some basic PHP Control Structures, what they are, and how to use them.
  • Chapter 3 — PHP Data Types
    • Learn about some primitive PHP Data Types, what they are, and some examples of how to use them.
  • Chapter 4 — PHP Functions
    • Learn how to use and create functions in PHP.
  • Chapter 5 — PHP Scope
    • Learn about PHP variable scope rules, like global scope, local scope, and PHP Super Global Variables.
  • Chapter 6 — PHP Classes and Objects
    • Learn about PHP Object Oriented Programming features, like classes, objects, visibility, and inheritance.
  • Chapter 7 — PHP User Input
    • Learn about HTML forms and how they can be used to receive and handle user input in PHP.

Otherwise, you can read the following precursor about why I started this tutorial….

How Should I Start Learning PHP

A lot of beginners ask, how should I start learning PHP? In all fairness it’s not a bad question and certainly not one that has been easily answered. PHP has been gradually evolving as a language for the past 16 years. It was not a language that someone thought out and developed – like C or Java – but, instead, one that was formulated by the efforts of various individuals over many years. Should you pick up a book and start learning? If so, which book should you read? Should you just learn online from websites like w3schools? Should you be turning to technical web-forums like stackoverflow or reddit, perhaps? Should you start reading the PHP manual? Maybe you should start with Zend’s PHP 101 Tutorials for beginners?

While these are all options available to you the problems they present are vast.

Read Books?

For example, a lot of PHP books that have been published over the past few years are either too advanced to explain the basics that some beginners are looking for or too diluted to help you along your way in becoming a professional programmer – starting with PHP. Some are also filled with misleading or incorrect information. Others are teaching bad or outdated practices. To be completely fair, it’s probably not always the fault of the authors. PHP has changed a lot over the years and many of its extensions and inner-workings were at one point poorly implemented or fundamentally broken. However, some of these books are just outright wrong and were probably written specifically to sell based on some buzzwords that seemed like good marketing at the time.

Examples of books like this would be books that contain PHP 6 in their title. Don’t buy books with PHP 6 in the title! Why? Because there is no such thing as PHP 6. Everything these books are telling you was all conjecture that never ended up materializing.

To give you an idea let’s take a look at “PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide” By Larry E. Ullman, which was published some time in late 2007. It’s currently late 2011 – that’s 4 years later. There is no PHP 6. This book claims PHP 6 will be released some time in late 2007 and that it will explain what features are coming in PHP 6 and how to use them. I had to think to myself for a moment, how could someone possibly write and entire book about a new major release of PHP, more than 4 years ago, and that version has never been released until this day? Not only that, but most of what is discussed in this book either has nothing to do with changes in PHP or is actually outdated information even for that time. What’s even more surprising is the book costs nearly $50 and after having looked through everything it discusses I assessed that you could probably get better information for free just by surfing the web and searching Google. Now, my point is not to badger a specific title on PHP or even slander any author writing books on PHP. I’m sure these authors have all invested a great deal of time and effort in putting together their published work. However, I would like to inform the public of just what they’re buying into when they seek out these books that appear to have intriguing titles on the covers with very little substance beneath.

To do that I spent a lot of time reading nearly every PHP book I could get my hands on over the past couple of years. So far there are only a handful of titles that I could honestly recommend for professional developers. If you’re just looking to get into PHP as a hobby you could probably save yourself some money – as these books don’t really seem to teach you anything you couldn’t learn online for free. Since I see a lot of beginners complaining that they don’t know where to begin or what to start learning first, I devised a series of PHP 101 tutorials in this section that go over the most basic concepts you should start learning first. They include direct links to the online PHP documentation, available at, and are listed in the order you should start learning them at the top of this page.

If you’re interested in a list of titles I would recommend for those looking to get into professional web development, here are a few…

  • Sams Teach Yourself PHP in 24 Hours — By Matt Zandstra
  • PHP 5 Objects, Patterns and Practice — By Matt Zandstra
  • Head First PHP & MySQL — By Lynn Beighley and Michael Morrison
  • The Non-Designer’s Design Book — By Robin Williams

Alright, depending on your learning curve Head First PHP & MySQL actually isn’t as bad as I thought it would be, at first. The only reason I listed it here was because after more thoroughly examining the book, I realized it takes a much more design-oriented approach to PHP and MySQL without actually teaching any bad or outdated practices (at least for the second edition, which was the one I read through). Don’t expect too much programming or DBA-type jargon from this book. It uses lots of visual aids and plenty of fly-by rhetoric. Now, the last one I picked up for myself, because I just have no right-side of the brain. I can write beautiful code, but I couldn’t design a banner-ad if my life depended on it. It’s true! I never quite got my ahead around front-end design. I know programming design-patterns; I can design database schemas; I can design APIs; I can even work with CSS and javascript; I just can’t create visually aesthetic designs (at least not easily)… Visual design just doesn’t come very naturally to me. This book was a quick read and very helpful from the non-designer’s point-of-view, which is me! It has nothing to do with PHP, but I put it here just in case anyone else comes from the same background.

Search The Web?

The next problem is if you do get your information from the web – you quickly realize the web is no small place. There are millions of web sites that use PHP and thousands-upon-thousands of them that offer information on using PHP. Not to mention the endless list of frameworks, libraries, extensions, packaged software like complete content-management solutions such as WordPress, Joomla, or Drupal. None of this is going to teach you how to program. At least not without leaving a lot of unanswered questions, voids, and gaps in your rudimentary programming knowledge. It’s only going to teach you how to write some code.

So what do I mean by that? Well, it’s simple. If you give a man a fish you feed him for a day, but if you teach a man to fish you feed him for a lifetime – as the age-old proverb goes. Sites like w3schools offer out-dated information and teach very bad practices. While the information on them seems well-presented and easy to digest it’s not a good place to learn PHP – or probably anything else. If you think I’m wrong read more about why w3schools is a bad resource.

Some people have told me they picked up on PHP from online videos like tutorials on youtube. These short tutorials, people put up on youtube, are essentially just tackling small various aspects of PHP. Just like I attempt to tackle various aspects of PHP and other topics on my blog. That works out great if you have a well defined problem you’re looking to solve and find one of these videos to help you solve it. However, it assumes you already have some prior knowledge to go on. That’s not going to teach much if you have no prior programming experience or you are looking to get into PHP as a profession and not just a hobby.

So other people directed my attention to sites like that offer, supposedly, professional video tutorials on various technical topics like PHP. Well, I went ahead and examined those as well to see what they have to offer. Yes, it does look very professionally put together and organized, but no, it doesn’t really teach you PHP in the sense that you will come out of it with any solid foundations. For one thing, these videos don’t all come with textual materials. Some of them require you to subscribe to a premium service and even then all you get is some sample code and exercises. This sample code misses a lot of key points and even the instructor in the video provides some incorrect information about basic language features. Clearly, this is someone that has spent a great deal of time working with PHP, but not someone that understands it well enough to teach it to others. Additionally, what shocked me about these PHP videos on was that they are more than 4 years old. That’s pretty old in the world of technology where the computer I just bought last year is available today, with twice the power and at half the cost. It’s significant in our context as well, because in the last 4 years PHP has changed a lot. It’s gained entirely new language features such as a revamped engine, namespace support, closures, and even traits. Not to mention a lot has been deprecated or removed since then. These tutorials are very outdated and even the majority of the material being taught is considered out-dated even for that time.

Visit Tech Forums?

So the question is should you then be spending your time in web-forums that attract large communities of tech professions for questions and answers, like stackoverflow or reddit, for example? Well, these forums are a great place for questions and answers, but again nobody there is likely going to hold you by the hand and show you in some orderly fashion how to start learning PHP, especially if you have zero programming background or are completely new to PHP. So, no hand-holding, means just getting quick guidance and direction when you’re stuck. This is great for when you’ve already gotten started down a certain path, but what about those who don’t even know how to get started?

Get Certified?

Some people ask me – well should I then go take a class or get some certification to learn PHP the right way? You could, but which certificate do you trust? Which class is worth your money and time? There’s the Zend Certified Engineer certification, which seems to be widely accepted, but it’s still not the be-all-end-all of PHP and most serious employers probably won’t care about your certifications. Employers actually care about results and proving yourself on the job – not always on paper (some do). Most of the Zend PHP Certified Engineer material proves you have a solid understanding of PHP, but it shouldn’t cost you money to prove that to someone. You can get the same solid understanding and prove yourself in the field without any certificates.

Then What?

If all of this leaves you feeling discouraged and depressed, don’t be! There’s hope. I promise you. All you have to keep in mind is that learning from a single source is never enough. I didn’t get to where I am today because I read a book, or because I watched a video, or because I searched a website. I actually read dozens of books, watched hundreds of videos, and searched countless websites.

I didn’t gather all of my information from a single source. This gave me the advantage of being able to see and compare what others were saying and I was able to weigh the validity of each and come to an unbiased conclusion. The point is don’t just take one person’s word and assume they are correct about X so they obviously must be correct about Y. On the contrary, most people tend to be very good at a small subset of things and very bad at the rest. This is what creates diversity of knowledge and specialization. No one person can consume absolute knowledge about everything. That’s why you have an eye doctor, a throat, nose and ears doctor, a brain surgeon and a heart surgeon – and many other doctors in many more fields. No one doctor can be knowledgeable or skilled enough to be an expert at all of those things at the same time.

So for those of you who feel lost and confused on where to begin and what to learn first; I’ve put together a short and to-the-point tutorial on PHP 101. This teaches you the most basic concepts first and doesn’t assume that you have any prior knowledge of PHP or programming at all. Instead the goal is to fill in the voids left by many other tutorials on PHP, which don’t explain the foundations properly to begin with. Without having a solid foundation your structure is only doomed to collapse – and would you rather it collapse a few months after you’ve began construction or know that it will collapse before you begin so that you can fix or build the foundation properly before that ever happens?

So take a look at the Table of Contents to start reading through the tutorials if you’re interested.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>