Dot notation in dealing with arrays in laravel. Is it worth to use?

In laravel there are a lot of helper methods related to working with arrays.
One group of these helpers is dedicated to point notation (e.g. arr::has, arr::get, etc.).

In principle, the appearance of your code becomes more readable, I think:
Arr::has($array, ['', '']);

isset($array['product']['data']['price'], $array['product']['data']['name']);

Is it worth it to work with arrays this way for the entire project?
Or can you give an example of a situation where you can use the dot notation (or why she did in this case was made?). I just except with the blade still wasn't used to it any way.
April 19th 20 at 12:40
1 answer
April 19th 20 at 12:42
Purely my IMHO. It's not standard.

If you can not use the helper - in principle the right thing to do, but it rather refers to the operators in the language ([]) and not the standard functions (which is isset()).

Arr::has($array, 'nested.key') instead of isset($array['nested']['key'])
Arr::get($array, 'nested.key') instead of isset($array['nested']) ? ($array['nested']['key'] ?? null) : null
$array['key'] ?? null and not Arr::get($array, 'key')
$array['key'] ?? doSomething() and not Arr::get($array, 'key', fn () => doSomething())

Find more questions by tags Laravel