The purpose of a function is to do a certain function at the time its called. like the following function:
function load(){
echo "i like this";
}
You put this function in your header or on top of the page and then you can call it down anywhere in your code and it'd echo "i like this."
However, functions can have arguments. so something like
function load($var1, $var2){
echo $var1;
echo $var2;
}
to use this you can define $var1 and $var2 in your page down the line and use it this way:
$var1 = "this is Variable 1";
$var2 = "this is variable 2";
load($var1, $var2);
Now you don't have to use the same name for the variables in the page as you used in the function it could be:
$age1 = "my age is 1";
$age2 = "my age is 2";
load ($age1, $age2);
and that'd give you the same result.
----------------
Never bother to learn something not knowing which does not do you any harm, and never neglect to learn something whose negligence will increase your ignorance - Imam Jafar Sadeq
|