Types of user-defined actions


Default functions

In default function only function call without argument or value.

Example:-
Program for default functions
 <?php
 function call()
 {
 echo "Hello PHP Function";
 }
 call();     //calling function
 ?>

Call by value or argument functions

Function will be call with argument or value.

Example:-
program for call by value or argument functions
 <?php
 function Hello($name){
 echo "Hello $name<br/>";
 }
 Hello(“raj");
 Hello(“rajesh");
 ?>

Call by reference functions

Function will be call with reference variable. The $var (single dollar) is a normal variable with the name var that stores any value like string, integer, float, etc. The $$var (double dollar) is a reference variable that stores the value of the $variable inside it.



Example:-
Program for call by reference functions
 <?php
 $x = "abc";
 $$x = 200;
 echo $x."<br/>";
 echo $$x."<br/>";
 echo $abc;
 ?>
Output
abc
200
200