We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Why did nobody tell me about this function? I've been converting objects to arrays for years in order to use
Arr::get()
. This changes everything 🙈The
data_get
function retrieves a value from a nested array or object using "dot" notation:$data = ['products' => ['desk' => ['price' => 100]]]; $price = data_get($data, 'products.desk.price'); // 100
continue reading on x.com
⚠️ This post links to an external website. ⚠️
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.