Arr::has($array, ['product.data.price', 'product.data.name']);
isset($array['product']['data']['price'], $array['product']['data']['name']);
[]
) 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