Re: Operations in PHP Hi, User-Defined Functions
The general way of defining a function is
function function_name (arg1, arg2, arg3, …)
{
statement list
}
To return a value from a function, you need to make a call to return expr
inside your function. This stops execution of the function and returns expr as
the function’s value.
The following example function accepts one argument, $x, and returns its
square:
function square ($x)
{
return $x*$x;
}
After defining this function, it can be used as an expression wherever you
desire.
For example:
print 'The square of 5 is ' . square(5);
__________________ Regards,
Senraj.A |