Best version of PHP to learn

Hi all,

This question has probably been asked many times before but I was wondering what would be the best version of PHP to learn as I will be looking to work with Wordpress and other PHP-based CMSs in the near future. I have enjoyed reading the ASP.Net Wrox book which I picked up from an auction website but am now looking at learning more front-end based languages such as PHP.

However, having found a number of books I am a bit confused as to the version number I should pick up. Many books which are quite a bit cheaper cover version 4 though I wonder if it is worth spending more and getting the latest? The highest version number a book covers I have seen is 5.3.

Any thoughts?


The latest version of course is the best.
But consider the version your web hosting currently has.
5.3 is fine.

PHP 5.3 was released in 2009 and goes end of life next month.

Don’t waste your time learning anything other than what the current version is. PHP 5.5. You can always check the documentation to see if a function or language feature is available to be used in a lesser version. But if you learn an older version, then you will have gaps in your knowledge and that is never a good thing.

The only reason I would read an older version book is if it’s free (eg. the public library) and only to skim through to get a feel for the basics.

Definately not worth your time (and as has been said, may even be harmful) to go to any great depth learning functions that may take different arguments, have better alternatives or even no longer exist.

Technology changes so fast that almost any book is already out of date by the time it’s published, but you’ve got to start somewhere.
I would suggest the most recent version you can reasonably afford, find out what version your host is running, then read the changelog/migrating documentation to see what’s different before getting too deep into writing any code.

PHP isn’t a front-end language it is a backend/server-side one. A small list of front-end technologies are HTML, CSS, and JavaScript.

If you’re familiar with c# or vb you shouldn’t have much trouble picking up the syntax and basics of PHP. Though understanding the entire ecosystem comes down to practice.

However, having found a number of books I am a bit confused as to the version number I should pick up. Many books which are quite a bit cheaper cover version 4 though I wonder if it is worth spending more and getting the latest? The highest version number a book covers I have seen is 5.3.

Avoid version 4 since 4 is vastly different from 5. However, when it comes down to minor releases I would say anything covering 5 would be fine though preferably 5.2+ with a focus on oo programming.

All the shared hosting providers I know of are now running PHP 5.4+ so that’s the minimum you’d be looking at having any WordPress and CMS scripts running on.

Oh come on, that is nearly impossible (from a book standpoint). So long as the book covers 5.X, you’ll be fine.

Skip books talking about PHP 4 as they’ll likely reference mysql_* related functions instead of PDO/mysqli. Most PHP 5 books will cover PDO and/or mysqli, which will set you up much better going forward (the syntax in 4 and 5 are identical, there are additional functions, better OOP support, etc in PHP 5 that you won’t find in PHP 4).

For a quick intro into PHP, consider trying the online course at Code Academy ( It won’t go over interacting with databases, but it will give you a quick intro to the syntax and resources available to you.

Point taken. PHP 5.5 was released almost a year ago. I would hope that is enough time for authors of existing books to add coverage of the latest version to new editions, or at least provide an addendum on their websites.

I did not learn PHP by a book. I scrounged for information online as I needed it. The result was gaps in my knowledge. Trying to save a few dollars by learning an old, outdated version of PHP will do more harm than saving a few dollars will do good.

PHP 5.6 is in feature freeze and release candidates are expected soon. So it may be finalized within a few months. PHP 5.3 will then be even more out of date.

Anything read in a hard-cover book will go out of date and possibly even be history by the time it takes to publish.

I would be tempted to learn the basics and subscribe to numerous PHP Forums and also set some daily “Google Alerts” on PHP developments.

I think but maybe wrong in the fact that if you looking to learn PHP to use on “Wordpress and other PHP-based CMS” software you will be resticted by the chosen software.

Also unless you are able to upload the latest PHP version to your site, you will be restricted to the PHP version supplied by your Internet Service Provider.

PHP basics can be learnt from this site:

and to clarify all PHP features:

Preferably to learn recent version of PHP, like PHP 5.5. I think you can learn PHP from, but from my experience, better to start programming from other languages like Java or C++, because they teach how to program in the right way. Also


Some tutorials:

Good luck!

Although the basics can be learnt any way and I recongnize W3Schools’ effort to teach all the technologies related to the web, and even like their schematic approach because it is easy to understand, short and direct… I’m one of those that will tell you to stay away from them.

Unless this has changed recently, they don’t have enough staff to keep it current and updated

I actually started PHP with a book (back in 1999). The book gave me a quick reference for syntax, language structure, etc that isn’t always very apparent online (or at least wasn’t then). I still usually get 1 or 2 books for each new language I want to adopt into my skill set, but I only use them for reference/a quick get to know the syntax from another person’s perspective.

Once they’ve done their job, I usually then hit up the language’s website, forums, etc to expand my learning and correct any assumptions I may have made along the way. Once you have a foundation, keeping up with the language and the changes that occur between versions is a responsibility you just have to take on. PHP probably is the worst language when it comes to the time you need to devote to this process. It’s constant version releases keep you learning new things about the language all the time.

For comparison sake, take a look at .NET. The 4.0 framework was only recently updated to 4.5 a year or two ago! 5.0 probably isn’t in the works for another year or two. And if you only want to look at when the CLR changed, that was back in 2010!

I’ve primarily reached out to Sitepoint books when picking up a new language, the reason is because I just follow them better than other authors. I feel like they fit me better for getting a quick foundation set versus O’Reilly or similar authored books. Their PHP/MySQL series is good, I strongly suggest using that for a first introduction, and if you can swing it, go through some of the videos on Learnable too (so maybe get a 1 month subscription and try to spend 5-10 hours a week there).

Just my 2 cents :slight_smile:

Best version of PHP to learn? That of course would be the Python 3.x version. (Humor).

hi all
best version for php to learn is PHP 5.4 & PHP 5.5+

Welcome to the forums :slight_smile:

Why is that exactly?
We value your input, but we don’t want the thread to degenerate into a list of unsubstantiated claims about which version is best.

The next reply that states “Version x is best” without any further reasoning will be fluffed.

Been away for the weekend and come back to a great list of replies - thank you very much all!
Sorry oddz, should have spotted that when posting - PHP is server-side not front-end - schoolboy error right there!

I think I will be picking up a PHP 5.X (probably 5.5) book just so that I can study when away from an internet connection (e.g. on the train) and then fill in the gaps with tutorial videos / documentation on

Thanks again all! Would welcome any further suggestions

Anything from PHP5 will work, since any differences between the versions are additional features, it doesn’t matter which version you learn, you’ll just be missing some features and as you can’t learn everything at once anyway, learning the differences between the versions is a good way of getting to grips with different features.

The best version to learn is always the latest version. Not only are you introduced to the newest features of the language, but you will be learning from a higher quality community, in the sense that they are the people who also stay current with modern programming techniques and how to implement them.

I’ve been programming PHP since 4.3 was edge, shortly before the 5.x branch was introduced. PHP has done a good job of maintaining backwards compatibility, so much so that you can learn from a manual covering 5.3 and expect all the materials in it to work. Moving backwards is where there’s a problem, but with time you’ll get a handle on what was introduced with each version. In brief…

PHP 4.x
The oldest code you are likely to be asked to maintain will be PHP 4.x. The language’s core is present here, but once you step into Object oriented programming this version will give you fits due to everything that’s missing. If you run across a server running PHP 4.x the whole setup is badly out of date. You can’t even get PHP 4.x packages precompiled for any distro anymore. If a project like this lands in your lap, the first priority should be migrating the code to a newer PHP, or scrapping it all and replacing.

PHP 5.0
Class scope was introduced, as well as much of the SPL (Standard PHP Library) which includes the spl_autoloader functions. The Reflection API also appears here I think, though the first few versions where buggy.

PHP 5.1
PDO became core. If you aren’t using it, you should

PHP 5.2
Json_encode and Json_decode show up. There was at one time a major move to set PHP 5.2 as the compatibility floor for many PHP codebases and, until recently it has been the floor, with only some of the newer libraries like Yii2 setting the floor to PHP 5.4

PHP 5.3
Namespaces where added, along with closures.

PHP 5.4
Traits and a more javascript like array definition syntax was added. Closures where improved to allow them to see the scope of the class they are in.

PHP 5.5
Adds a new password library and generators

PHP 5.6
Improved the syntax for argument overloading on functions, functions can now be imported between namespaces.

As can be seen from the above, much of what is different about each version isn’t stuff a beginning programmer is likely to make a lot of use of, with the exception of PHP 5.4’s array syntax. So don’t worry too much about which version as long as you are on the 5.x branch somewhere.

There’s a big difference between beginner programmer and a programmer being new to PHP…even if we assume all the PHP noobs are first time programmers, not learning advanced concepts because you may not use them immediately isn’t really a reason to avoid being exposed to them and all the philosophies and ideas associated with that level of programming. In fact, PHP 5.5’s password_hash() function (and it’s surrounding concepts) is one of the first things a beginner should learn, after they learn the very basics. I mean, how long does it really take to learn echo, variables, functions, loops and other very basic things? A week? I mean really, C was my first language, and I learned that and Python at the same time as a wet behind the ears kid who didn’t know a variable from a compile error. After all, one of PHP’s greatest strengths is it’s ease of learning and use