even if i do understand what everything is doing,I can't seem to find the logic in what
return $totaal does. Below that working code:
<?php
function Adding ($getal1, $getal2){
$totaal = $getal1 + $getal2;
return $totaal;
}
function Substract ($getal1, $getal2){
$totaal = $getal1 - $getal2;
return $totaal;
}
$getal1=10;
$getal2=2;
echo Adding ($getal1, $getal2) . "<br>";
echo Substract ($getal1, $getal2);
?>
I make my function and i call it later by echo'ing it but what does that Return $totaal do in the function. I never call it, but without that return i get blanks.
I must be missing some kind of logic in my brains....
echoconstruct needs an argument to perform its work. That argument is the value returned by the function.Think of it like this -First addition is done, then value is returned, and then echo uses that value to print it.