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)
![moath alqutoob](https://secure.gravatar.com/avatar/6dba99da57ed109c5e23c13a95ae325a?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
moath alqutoob
2,450 Pointssome on help me in this code
n the main code, outside of the function, use the new mimic_array_sum() function you just wrote. Store the return value in a variable called $sum, and then display that sum to the screen.
<?php function mimic_array_sum($array){ foreach ($array as $element){
return array_sum($array) ; } }
$sum=mimic_array_sum($palindromic_primes);
$palindromic_primes = array(11, 757, 16361);
return $sum;
?>
the error
1 Answer
![Max Smith](https://secure.gravatar.com/avatar/6c2b0294f15fa2d964f43f77c3ec971c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Max Smith
Courses Plus Student 3,973 PointsI think your return inside your foreach may need to return: array_sum($element);
Max Smith
Courses Plus Student 3,973 PointsMax Smith
Courses Plus Student 3,973 Points** return $element
Max Smith
Courses Plus Student 3,973 PointsMax Smith
Courses Plus Student 3,973 PointsJust need to be a bit clearer, what is it you are trying to do?
Max Smith
Courses Plus Student 3,973 PointsMax Smith
Courses Plus Student 3,973 PointsJust need to be a bit clearer, what is it you are trying to do?