In PHP you can also pass the argument to the function . These argument are the may be variables or constants values. Function can be handed variables, so that you can pass the variable over to your functions by typing them inside of the round brackets of the function name and also you can directly pass the value to the function. when we pass variable we say " Passing Arguments by Reference ". If we pass value as argument the we say "passing Argument by Value".
Following example pass an integer value to Function.
"; display(200); ?>
This will display following result:
This code is written out side the function below code call the function
This is your passed value=200
A function can also return the value to calling function . The function may be return one or more then value in form of array.
For example:
We takes two integer parameters and add them together and then returns their sum to the calling program.
The default value of function parameters is, if we declare a function which get some argument but if we not pass any parameter then this default value us used as parameters.
In above code the function, display call with out any argument . but in Out put this function display the "Learninghints".
Variables in PHP
PHP Concatenation
Calculation in PHP
If Statements in PHP
if ... else Statements in PHP
Nested IF Structure in PHP
PHP Comparison Operators
Switch Statement in PHP
Logical Operators In PHP
PHP Booleans
FOR Loop in PHP
While Loop In PHP
foreach Loop In PHP
Break Statement
Array In PHP
Associative Array
The Count function
Changing Case Function
Trim Function In PHP
Str_shuffle( ) function
strpos function in PHP
Explode() Function in PHP
Function
Passing Function Arguments
Server Variables
Header Function
Include Function
The require Function