A concise conditional method calling in PHP using variables for method names

A very naive yet effective approach on metaprogramming that helps you dynamically call the right method in a very concise manner.

```
$method = $user instance of User ? 'save' : 'saveMany';

$this->members()->$method($user);
```

The example is an excerpt from a dummy Laravel app.

nickciolpan
30 Sep 2020