Define whether a variable is passed by value or reference : Parameters « Functions « PHP
- PHP
- Functions
- Parameters
Define whether a variable is passed by value or reference
<?php
function f1($a) {
$a += 4;
}
function f2(&$a) {
$a += 10;
}
$b = 5;
f1(&$b);
f2($b);
echo "\$b = $b\n";
?>
Related examples in the same category