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 trialdavidha
5,041 PointsDifferences in getCombinedIngredients method from previous video
Am I missing something, or does a chunk of code in the middle of the getCombinedIngredients method in recipecollection.php change from the previous video?
I have this from the previous exercise...
if (substr($item, -1) == "s" && array_key_exists(rtrim($item, "s"), $ingredients)) { $item = rtrim($item, "s"); } else if (array_key_exists($item . "s", $ingredients)) { $item .= "s"; }
whereas in this video it looks as though it's changed to...
if (in_array($item,"s", $ingredients)) { $item.="s"; } else if (in_array(substr($item, 0, -1), $ingredients)) { $item = substr($item, 0, -1); }
I can't see any reference to this change in either video?