PHP

How to demonstrate the call by value parameter passing in PHP | PHP programs

How to demonstrate the call by value parameter passing in PHP | PHP programs

How to demonstrate the call by value parameter passing in PHP | PHP programs

We will pass parameters using call by value mechanism to the user-defined function. In the call-by-value parameter passing, the updated value of parameters does not reflect in the calling function.

<?php


function Sum($num1, $num2, $num3)
{
    $num3 = $num1 + $num2;

    echo "Inside function->num3: " . $num3 . "<br>";
}

$num1 = 10;
$num2 = 20;
$num3 = 0;

Sum($num1, $num2, $num3);
echo "Outside function->num3: " . $num3;
?>
TutorialsLink Curator

This is an official account managed by the team TutorialsLink Community