Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAlexander Costa
11,464 PointsHow does the for each know to grab the ID?
So around the end of this video we are told to include the $product_id in the foreach loop.
by adding the "_id" to any name does it know to grab its ID number?
Sorry if I am not typing this in a understandable way. I am just confused on how the server KNOWS to grab the id for the arrays element.
1 Answer
Hugo Paz
15,622 PointsHi Alexander,
The easier way to understand how foreach works is to look at the documentation.
If you are still having trouble, please post the code you are having issues with and we will help step by step.
Alexander Costa
11,464 PointsAlexander Costa
11,464 PointsWow... Get it now. Bookmarked the page.