+ 1
I tried ro do math with function in php
<?php $a = 1 $b = 1 function sayHello() { echo $a / $b; } sayHello(); //call the function ?> Help, please
3 Réponses
+ 2
the first answer is right, your function don't have access to the "$a" and "$b" variables, you should pass them as parameters
function sayHello($a,$b){
echo $a/$b;
}
sayHello(1,1);
+ 7
your indentation for the calling of the function? That seems wrong...