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!

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

some 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

I think your return inside your foreach may need to return: array_sum($element);

** return $element

Just need to be a bit clearer, what is it you are trying to do?

Just need to be a bit clearer, what is it you are trying to do?