## 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. # Introduction User-Defined Function 3of 3

It looks like you have not created a variable named \$sum in your main code, outside of the function. Please create it and store the return value from the mimic_array_sum function call in it.<?php

function mimic_array_sum(\$sum) { \$sum = 0;

```            foreach(\$array as \$element) {
\$sum = \$sum + \$element;
}
return \$sum;
```

}

\$palindromic_primes = array(11, 757, 16361);

?>

Bummer!It looks like you have not created a variable named \$sum in your main code, outside of the function. Please create it and store the return value from the mimic_array_sum function call in it. where do you place the variable? STAFF

Your function code looks right. Now you need to create a variable outside of the function, like this:

```function mimic_array_sum(\$sum) {
\$sum = 0;

foreach(\$array as \$element) {
\$sum = \$sum + \$element;
}
return \$sum;
}

\$palindromic_primes = array(11, 757, 16361);

\$sum = ____;
```

\$sum = 17118; \$sum = 0; \$sum = return; Which one or do I need to go back to math class STAFF

The instructions ask you to do this:

Please create it and store the return value from the mimic_array_sum function call in it.

That means do this:

```\$sum = mimic_array_sum(\$palindromic_primes);
```

In earlier step, we wrote the `mimic_array_sum` function that receives an array of numbers and adds up all its elements. In this step, we need to call that function. We pass in an array of numbers (`\$palindromic_primes`), and the function returns the sum of them. We then load that return value into a variable named `\$sum`.

Does that help?

<?php

function mimic_array_sum(\$array) { \$sum \$sum;
foreach(\$array as \$element) { \$sum = \$sum + \$element; } return \$sum; }

\$palindromic_primes = array(11, 757, 16361);

\$sum = mimic_array_sum(\$palindromic_primes); ?> "Still say's bummer! STAFF

"Bummer" means you have invalid PHP code. You changed a line from what you sent me earlier. You now have this ...

```<?php

function mimic_array_sum(\$array) {
\$sum \$sum;
```

... but you used to have this:

```<?php

function mimic_array_sum(\$array) {
\$sum = 0;
```

It was correct before, and you'll need to change it back.

It looks like you are not displaying anything to the screen. Be sure to use an echo command.

function mimic_array_sum(\$array) { \$sum = 0; I tried: echo sum = 0 echo 0;