Function
<?php
function add($a,$b)
{
echo $a+$b;
}
add(2,3);
?>
Outrput:5
<?php
function add($a,$b)
{
return
$a+$b."<br>";
}
$a =add(4,5);
echo $a;
?>
Output:9
Variable Variables:
In function
, here we can also use variable variables process. Where we can assign function
name in another variable.
For
example:-
<?php
function add($a,$b)
{
return
$a+$b."<br>";
}
$fun='add';
echo $fun(5,6);
?>
Output:11
Here ‘add’
function name is assign in ‘$func’.
Comments
Post a Comment