Any parameter that is passed to the function does not change the value when the function exits.
That is, when we pass a parameter to a function, a copy of this parameter is created and inside the function we work with a copy of the parameter.
PHP
<?php
// declare a function
function SetValue($x)
{
$x = 10;
}
// create a variable
$a = 20;
// call the function
SetValue($a);
print($a); // we will see on the screen 20
?>
PHP
<?php
// declare a function
function SetValue(& $x)
{
$x = 10;
}
// create a variable
$a = 20;
// call the function
SetValue($a);
print($a); // we will see on the screen 10
?>