shlogg · Early preview
David Duymelinck @xwero

Php 8.1 Simplifies Code With New Syntax

Php 8.1 introduced new syntax: $this->foo(...) instead of [$this, 'foo']. Makes code more expressive and easier to read.

As I mentioned in my previous post this is going to be a series.
This post is going to be a short one. But it made php code easier to read for me.

  
  
  Theory

Php 8.1 introduced this syntax.
Before you wrote [$this, 'foo'] and from php 8.1 you can write $this->foo(...). 
Routers in frameworks like Laravel and Symfony use the old way in their documentation. That is why I think a lot  of people are still unaware of the new syntax.

  
  
  Code

The syntax not only works on class methods, but also on functions. This means you can write $uppers = array_map('strtoupper', ['a', 'b', 'c']); now...