Copyright © tutorialspoint.com

PHP Function Parameters

previous

Scope can be defined as the range of availability a variable has to the program in which it is declared. PHP variables can be one of four scope types:

NOTE: PHP Functions are covered in detail in PHP Function Chapter.

But in short a function is a small unit of program which can take some input in the form of parameters and does some processing and may return a some value.

Function Parameters:

Function parameters are declared after the function name and inside parentheses. They are declared much like a typical variable would be:

<?
// multiply a value by 10 and return it to the caller
function multiply ($value) {
    $value = $value * 10;
    return $value;
}

$retval = multiply (10);
Print "Return value is $retval\n";
?>

This will produce following result.

Return value is 100
previous

Copyright © tutorialspoint.com