Home of web learners


In function you can use advance things to make its better use

You can pass argument in calling function

For passing argument you also have to declare parameter to the corresponding argument to pass value

Lets look an example

function showtext($fruit){
echo $fruit;



Here,you see that what you give inside calling function shows as output

In function define we use a variable named $fruit inside () which is reserved for parameter of a function,here we can use variable which is parameter of function

Here,in calling function we can pass data,we pass orange,inside () of calling function,we can pass data from calling function like this,which data assign to $fruit in called function

In the body of function we can use parameter variable,here $fruit,we just show it here by echo $fruit

Lets go to another thing

return of a function

A function can use like a variable,which can pass data

Lets look an example

function shownum(){
return 5;
echo shownum();



Here,you see that output is 5,we use here return in calling function body,it is the exit point of a function,when function find reutrn in body,it stop execute function,stop there and goto called function

We can pass data by return function,here we see that we use 5 in ruturn function,we can use other type data also like string as example return "orange"

we see that we can use function as variable,here we use shownum() as variable and it show its result 5 as total value comes from function is 5


About webn3rd