Ask HN: Should I learn PHP in 2017?

4 points by swah ↗ HN
Tell me if I'm tripping:

Here in Brazil most small companies still use PHP due to virtual hosting, to deliver to clients which host themselves on shared hosting. VPSes are relatively expensive, unless you host in US.

I never learned PHP because I took the "high way", read HN and rather learn Python which was elegant and all that. Then later I learned clojure, golang...

PHP was the "ugly language", not the language projets from zero would use, etc. I have had this "prejudice" for 10, 15 years.

I don't work with web day to day actually (doing embedded C work), but I'd like to freelance sometimes, and today I just saw a client asking for a CRM to integrate on their page: their website? PHP of course.

Should I actually learn PHP these days to serve this kind of client, which is the most common client to get small jobs in my country? Or this is crazy and I should just tell them I work with Python?

In other words, my mind was trained in a "SF bubble", but money must come from clients near me.

Thanks in advance.

11 comments

[ 3.5 ms ] story [ 32.8 ms ] thread
Depends on you and your situation really. Do you need / want more work? Are there not enough customers for the Python jobs?

If you feel OK with Python and a few other languages, you will find PHP trivial to learn. There's nothing wrong with learning another language. Is it ugly? Yes. Are you going to deal with terrible code? Most likely. Is it worth it? Only you know that.

I would be happy to take lower pay if it meant not having to deal with PHP - up to some threshold. Below that, a programming job is a programming job - I wouldn't say no if the offer is great.

You're not going to suddenly lose everything you learned though. All those other languages and skills will help you write great quality code and you'll spot more familiar patterns everywhere. If you have time, it could be a good idea to learn PHP just to know why it your prejudice holds and why exactly is it ugly.

It's also a good long term investment. Due to existing code, trivial hosting, active frameworks, and lots of users, PHP jobs are not going away any time soon. Especially the small "modify WordPress/drupal/whatever to do X" kind of jobs.

PHP is a tool, nothing more, nothing less.

Take a look at modern PHP practices and try the language out, base your decisions on evidence rather than the trends of a market you're not even operating from.

I'm in Texas, and I'm currently working in an Amazon warehouse so I can afford to be closer to the markets in Austin. I have a degree in C# and C++ business app design and most of the programming work I do is still javascript and PHP, because that's what's available.

PHP may be an ugly language, but it's not torture and sometimes you have to go where the money is.

I think you may have answered your own question. If most of the potential clients are using PHP, and you want to service those clients, then it makes sense to learn PHP.

I understand where you are coming from re the "projects from zero" comment but that's mostly wishful thinking. PHP is, in many ways, an ugly language but a lot of people have found it a useful language and a lot of people still do.

>Here in Brazil most small companies still use PHP due to virtual hosting, to deliver to clients which host themselves on shared hosting. VPSes are relatively expensive, unless you host in US.

That's the case all over the world, including in the USA.

>Should I actually learn PHP these days to serve this kind of client, which is the most common client to get small jobs in my country? Or this is crazy and I should just tell them I work with Python?

Go where the clients are. If you want to work in SV, you could forego PHP and learn Node or Rails. Or if you want to work in banking etc, where would mostly be Java, C# etc.

But for those kind of jobs (which can be quite substantial, some of the biggest websites are run on PHP, including Whitehouse.gov, The Wired, and tons of high profile sites), PHP is a good choice, and PHP7 has never been better in language features, ecosystem, libraries, good practices, etc.

To put it another way: Javascript is in not much (if at all) better than PHP as a programming language, and people used to laugh about it to for "serious programming". But since everybody is forced to use it on the browser side, it eventually caught on, and nowadays you have JS snobs looking down on PHP. So those things are mostly based on fashion that actual technical merit.

You can write very good and clean code with PHP, especially now with 7.1

Grab a copy of clean code, familiarize yourself with composer (which is an awesome package manager) and you are good to go.

Just avoid crappy code like wordpress and co, stick with OOP and you won't regret it.

This is kind of like a carpenter asking if they should learn to use a different brand of hammer since a lot of other carpenters use that brand.

Customers pay for solutions to business problems. They don't pay for programming language expertise. As another commenter wrote, PHP is a tool, like all programming languages. Some are subjectively uglier or prettier or more fun than others. But they are transient. In 35+ years of programming I've used and forgotten a lot of languages, they don't matter as much as programmers think they do.

If you get the chance to build something from scratch and you honestly think using Python (or whatever) best serves the customer's needs (not yours), great. Besides the shared hosting setups and huge amount of legacy PHP code, it's still a popular language. It's easier to find PHP programmers to help or take over a project than it is with other languages and tools.

PHP and Python are more similar than different, if you have mastered one you can master the other. Then you have more skills to apply to business problems. Programmers who insist on specializing in specific tools are painting themselves into a corner.

Thanks guys. I'll see how integrated this functionality has to be to the site, and just use PHP if needed. Otherwise Python, which would be quicker for me.
If you have a job asking you to write or maintain PHP software, then you should indeed learn it enough to do a good job.

But otherwise, IMO, your time would be better used learning something else, or another programming language. For example, learning Common Lisp (or scheme), or Haskell, or Prolog, etc, would let you learn new concepts and make you a better PHP programmer in the end, because learning those languages would make you a better programmer in general.

http://www.dmi.unict.it/~barba/PROG-LANG/PROGRAMMI-TESTI/REA...

PHP is in the second little pink box on the right "Sequential object-oriented programming". There are a lot of other boxes to learn!

(comment deleted)
Thanks, I tried most of those languages at some point in time... its more about the market.

(Haskell, Javascript, Ocaml, Lua, Python, Common Lisp, Clojure, Emacs Lisp, Golang, Erlang, Python, Ruby, Java...)