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 trial

PHP Build a Simple PHP Application Integrating with PayPal Forms, Arrays, and Get Variables

Integrating with Paypal // Stage 5 -QUIZ

if (isset($flavors[$_GET["id"]])) I don't get it..., isset means to search if $flavors is not null , now how can you possibly search $_GET as an index inside $flavors... how can it be an index?

1 Answer

Hi asaf,

$_GET["id"] is going to retrieve the id number that's in the query string of the url. It's that id that will be used as an index into the flavors array.

Suppose the url ended with '...?id=1' then $_GET["id"] is going to equal the string "1".

The code would then simplify to this:

if (isset($flavors["1"]))

Since that string is a valid integer it will be cast to the integer 1 and that code will then be checking if the $flavors array at index 1 is set to something.