A function that takes a reference for an argument : Parameters « Functions « PHP
- PHP
- Functions
- Parameters
A function that takes a reference for an argument
<?php
$my_int = 10;
print("Before change_value(), \$my_int =" . $my_int . "<br />");
function change_value(&$var) {
$var = 15;
}
change_value($my_int);
print("After change_value(), \$my_int = " . $my_int . "<br />");
?>
Related examples in the same category