DEV Community

Discussion on: Are there functions similar to Ruby's `dig` in other languages?

Collapse
 
suhayb profile image
Suhayb Alghutaymil

In Laravel you could use this with Arr::get helper method.

use Illuminate\Support\Arr;

$array = ['products' => ['desk' => ['price' => 100]]];

$price = Arr::get($array, 'products.desk.price');

// 100