I have got this function in php that run and return a number. However what i want is the numbers to be add up each time the function is run.
Here is the code.
function sumRate(&$numbers) {
$sumArray="0";
if($numbers)
$sumArray=$numbers;
$countedArray=($sumArray+$numbers);
echo "<script>console.log('$countedArray')</script>";
}
example when button click Jquery Ajax sent the value to server side.
let say
sumRate("23");//console log 23
sumRate("20");//console log 20
but what I want is that each time the function is run console to log 43 instead of login each number
Weldone in advance