Hey guys, had another question regarding a PHP function.
I have to :
Write a function named “addThemUp” that accepts 1 parameter using a loop
adding all integers from zero to the number it receives and return the total, and here is the function i have to use without using an array.
function addThemUp($parameter1) {
// The parameter name can be whatever you want.
// Your code goes here.
};
Here is my function that i have tried to use and is not correct, would appreciate a pointer or two!, Thank you!
function addThemUp($parameter1) {
$total=0;
//this will start finding numbers from zero
for ($i=0;$i<=$number;$i++) {
total=$total+$i
return total;
};
};
I am well aware that this is wrong, would appreciate some pointers! Have a blessed day