Support the ongoing development of Laravel.io →
Database Eloquent

The doc tells:

When working on forms with "array" inputs, you may use dot notation to access the arrays:

$input = Input::get('products.0.name');

ok .. so I have this array:

array(3) { ["_token"]=> string(40) "kxIJp6UAzBhi4zwymO4MYO17KtuGQjS5EL6KLDDX" ["product_id"]=> string(1) "1" ["category_id"]=> string(2) "15" }

What is the correct syntax to access values for product_id and category_id ?? I can't figure out

Last updated 3 years ago.
0

Try

foreach($input as $inp){
    echo  $inp['product_id']
}```
0

Sign in to participate in this thread!

Eventy

Your banner here too?

chriz74x chriz74x Joined 8 Apr 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.