Follow The New Tutorial updates on WhatsApp, Telegram or YouTube.

PHP Function Arguments or PHP Parameterized Function

You can pass the information in PHP function through arguments. Function arguments or parameters are separated by comma.

Function parameters are specified inside the parentheses, after the function name.

Information may be passed to functions via the argument list, which is a comma-delimited list of expressions.

You can pass any number of parameters inside a function. These passed parameters act as variables inside your function.

The arguments are evaluated from left to right, before the function is actually called (eager evaluation).

Argument values are passed during function call.

Example

<?php
//Adding two numbers
function add($x, $y)
{
    $sum = $x + $y;
    echo "Sum of two numbers is = $sum <br><br>";
}
//Values are passed during function call
add(800, 700);

//Subtracting two numbers
function sub($x, $y)
{
    $diff = $x - $y;
    echo "Difference between two numbers is = $diff";
}
sub(900, 400);
?>
PHP Function Arguments or PHP Parameterized Function example output