Should I learn PHP or React?

By Bernie FitzGerald •  Updated: 04/04/22 •  3 min read

There is no right or wrong answer here. You need to consider what you are trying to build. PHP is great for back end programming whilst React can be server-side or client-side, plus React is just a Javascript library (although don’t let that fool you into thinking React is simple) which means if you already have Javascript knowledge you can get going more quickly than PHP.

What about the job market?

If you are concerned about the job market then either choice is again still fine. PHP has been around a while and it is in use in a large number of places. Just take a look at the WordPress home page. At the time of writing this article WordPress powers 43% of the internet… That is an impressive number by any standard.

React on the other hand is certainly in use in a lot of companies, especially newer startups and large organisations. So learning React will also put you in good stead for landing a role.

Is PHP harder to learn than React?

Having learnt both PHP and React (albeit at different stages of my career) my personal experience with the learning curve was that PHP was a little easier. Especially when you look at the documentation and there are user-submitted notes under each document showing different use cases and discussions regarding the function that you are reviewing. This really helps ease the understanding.

React, to me, took a little more of a mental shift. Moving towards a declarative model takes a little getting used to as well as determining where your data should live in your app can be confusing at first. My personal worst part of programming in React is the use of NPM to build applications. It seems like you spend a lot of time maintaining your packages to avoid security concerns, more so than I noticed working with PHP.

Other differences worth noting

The build process is another aspect of programming with React. Your source code needs to be bundled into plain Javascript from JSX which means you need a process of transpiling your code in your build pipeline. This is fine on smaller projects but can get quite time-consuming on larger projects when you start needing to bundle 3rd party packages that have nuances in them that don’t work with Webpack or some other bundling tool.

Getting help with PHP and React

Looking for help from the community is probably a draw for React and PHP. Mainly because PHP is old enough for the internet to have many blogs, articles etc… written about how to get things done. React is great community wise as Discord, forums and blogs are quite active with in-depth React conversations. StackOverflow for both is great too.

In conclusion

It really does depend on what your aim is. Neither language is more or less suitable for small or large applications and both are used widely in enterprise settings. React can really help with creating reusable components in your front-end (especially when combined with something like StoryBook) whereas PHP can help drive server-side processing and data handling.

The internet at the moment tends to favour newer frameworks and languages and PHP takes quite a hit in the popularity department. That being said, depending on the circumstance I would be happy using whatever helped me get the task done more easily.

Bernie FitzGerald