Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
I cannot, for the life of me, understand what I am doing wrong. I'm ready to skip this challenge but I'd prefer to know what it is that I don't understand.
<?php $numbers = array(1,5,8); array_sum($numbers); echo $sum; ?>
Simon Woodard6,545 Points
You haven't stored anything in the variable $sum so it wont echo anything out :)
Alex Heil53,534 Points
hey Eric Chunn , actually you're pretty close to the right answer and Simon Woodard gave a good hint. To "sum" this up: You have successfully replaced the old loop and replaced it with the array_sum function. You also passed in the numbers array correctly, what's missing is the assignment of that function to a variable, like this:
$sum = array_sum($numbers);
then you could echo it out and the challenge would pass just fine. hope that helps and have a nice day ;)