Passing by Reference in PHP
<?php
function reference_test($var, &$result, &$result2) {
$result = "This is return value #1";
$result2 = "You entered $var as your parameter";
return 42;
}
$res = reference_test(10, &$res1, &$res2);
echo "The value of \$res is '$res'<BR>";
echo "The value of \$res1 is '$res1'<BR>";
echo "The value of \$res2 is '$res2'<BR>";
?>
Related examples in the same category