Should I brush up on PHP or move on?

Coming back to Web design after many years away. I watched a couple YouTube videos that talk about PHP being on the way out. If that’s the case, is it worth brushing up on it, or should I learn Python (which seems to be the trend)?

No, what a lot of people are saying isn’t true. A lot of it boils down to hate of the language. Some people have way too much pride to really get of that 1990’s mindset so they just assume PHP is the same way it is now from 2 decades ago. It’s entirely false. We just got PHP 8 officially in November of 2020. With PHP 8, PHP has become far far faster than it ever was 2 decades ago. Some huge features that PHP 8 has brought to the plate are

  • A JIT (Just-In-Time) compiler
  • Mixed type declarations. I feel conflicted on this part. A part of me is actually really happy they finally added mixed typings which means you can run multiple data types and pass them in your methods or have multiple returned types. An example of this is bool|array which means I could return a boolean value or an array value. It does have it’s perks, but also a lot of people prefer to stick to 1 data type.
  • Null type safe operator

And many many many more features that come from the previous version, PHP 7.

So to say

PHP being on the way out

is just completely untrue and most likely from someone who just hates PHP and doesn’t have much to contribute other than spewing enormous lies. PHP does have the reputation to get those kinds of reviews because a lot of those reviews are uninformed developers with a 1990’s mindset.

So to answer your question, it depends on what you really want to do. PHP is a good start. I would suggest opening your mind to a lot more languages though. This will help you later down the road.

5 Likes

Thank you! Yes, definitely open to more languages, but really didn’t want to leave PHP behind. It made me a lot of money back in the day. :slight_smile: Good to hear the nice improvements in 8, though I would agree the mixed type declarations seem… different, but still useful.

JavaScript has seen some changes as well. For instance, let being the successor to var. Seems I have some serious catching up to do, lol.

You’ll find that HTML and CSS has moved on quite a bit too. :slight_smile:

2 Likes

Python is mainly a trend for Machine Learning and AI. Not so much for web development (unless I’ve really missed something?)

Which was the last version you used? Have you ever worked with PHP 7? That also has a lot of advantages over PHP 5. (PHP 6 never existed, due to reasons)

A thing I also quite like about PHP8 is constructor property promotion. So instead of

class Foo
{
   private string $bar;
   private string $ban;

   public function __construct(string $bar, string $ban)
   {
      $this->bar = $bar;
      $this->ban = $ban;
   }
}

you can now do

class Foo
{
   public function __construct(private string $bar, private string $ban)
   {
   }
}

Which means the exact same thing, but uses a lot less code :smiley:

2 Likes

I’m no expert but I find Python difficult to use for web dev. You can’t swap in and out of Python the way you can with PHP.

PHP is quite useful today, but if I had a choice, I would like to specialize on some other application, because PHP accepts a lot of shit in code.

I last worked with PHP 5, whichever 5.x version was the latest in early 2015. And wow! That constructor property promotion is awesome!

Care to expand on that a little? What would you suggest? I know that PHP is still relevant, but I also feel there must be some languages that are pretty much required for 2021.

PHP is simple. That is its advantage and also disadvantage. I think PHP will be used in small and middle-size business-projects exactly due its simplity.

Problem is - a lot of employer will use not profi as developers. That’s why they will have a code of very low quality.

To reduce the amount of crap you can code in PHP I would recommend installing tools like PHPStan or Psalm (pick one, not both). These tools take a look at your code and will tell you were potential problems are. PHPStan has prevented a lot of bugs where I work.

2 Likes

Thanks @rpkamp! I’ll definitely look into those!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.