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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Cliff Jackson](https://secure.gravatar.com/avatar/3f12f189fd94c22610f06ca45cc01dad?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Cliff Jackson
2,887 PointsCan someone explain clearly what is happening here, why is the output A?
<?php
$flavors = array();
$flavors[1] = "Cake Batter";
$flavors[2] = "Cookie Dough";
if (isset($_GET["id"])) {
if (isset($flavors[$_GET["id"]])) {
echo $flavors[$_GET["id"]];
} else {
echo "B";
}
} else {
echo "A";
}
?>
1 Answer
![Dennis Amiel Domingo](https://secure.gravatar.com/avatar/1dc512e9af1330ec26b1b6af6ae37948?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Dennis Amiel Domingo
16,213 PointsThe "id" variable wasn't set therefore the conditional wasn't met.
At least I think that's what it is.
Cliff Jackson
2,887 PointsCliff Jackson
2,887 PointsThanks i figured it in the end.