Why Teach Code with PHP, and not Python?

February 15, 2015
Posted in Classroom Stats


UPDATE: In 2016, if I had to choose only one programming language to teach, it would be JavaScript. That said, PHP is still a great option, but I would teach it after JavaScript. I recently wrote about why JavaScript is now my first choice.

Back to the original article:

These days, Python and Ruby are popular programming languages with the tech startup crowd, and so, many of the venture capital backed ‘teach code’ startups, have ruby or python courses targeted at kids.

The problem is that these are not the best languages to teach programming with- especially with people who are new to programming. So, why is PHP better?

1. PHP is easier to learn:

Python and Ruby are object-oriented languages at their core, so to do anything with the languages, you really have to understand object-oriented theory and principles. This adds an unnecessary level of complexity to new learners.

Yes, modern software development is largely object-oriented, but my 10+ years experience in teaching web development has taught me that it is better to teach basic programming concepts and techniques before adding the OOP (object-oriented programming) layer.

PHP has both an object-oriented layer and a much less complex layer that is ideal for teaching programming to new learners- especially younger students.

2. With PHP, it’s easier do real things.

With PHP, because it was designed specifically for the web, you can create web apps fairly quickly. On top of that, getting PHP apps live is also trivial- just upload the files to a PHP enabled server, and you are done. Try that with Ruby or Python!

Ruby and Python were not designed with web apps in mind. They were put together more as general purpose languages and have been adapted for the web. Yes, they are both excellent languages, but there is that additional layer of complexity when it comes time to actually creating a web app and going live.

These days, if you are creating apps, they are most likely web apps! So this is relevant.

3. PHP is BY FAR the most used web development language – it’s not even close!

If you are looking to put practical skills into your students’ hands, then PHP is easily the best choice. Check out this simple stat: over 80% of dynamic websites, that is to say, websites that are also web apps, are created with PHP. Ruby and Python together may add up to 7%.

In fact, what I hear from new programmers time and time again (after they learn Python or Ruby) is they discover that they have to learn PHP, since there are so many more jobs in the PHP world.

Consider this next stat: WordPress runs about 23% of the world’s websites!! Add in Joomla and Drupal (two other popular CMS’) and we are probably close to 30% of the world’s websites being run by 3 web apps created with… PHP!

…There is no equivalent in the Ruby or Python world.

The point here is that there is a huge ecosystem in PHP that no other language comes close to. When selecting technologies, we all know from the Apple Appstore, that the ecosystem is hugely important. It’s a big reason why iPhone is so successful.


It seems clear that if you want to teach kids (adults too!) more easily and you want them to be able to easily see their code actually do something real, PHP is the obvious choice.

Add in the market viability of the language and the growing probability that Ruby will slowly fall into a micro niche (it’s already niche IMHO), then there is really no argument. You can see why StudioWeb teaches programming with PHP.

Final note:

I chose to teach programming with PHP in 2004, NOT because I was a PHP programmer zealot. I’ve written software in 8 or so languages, I am language agnostic. In fact, my favourite language for years was Java… I’ve written more lines of Java code than any other language.

No, I still chose PHP to teach programming because it was the best choice.

I hope you find this helpful.

Stefan Mischook

To Top