Re: PHP Tips and Tricks Returning References
Passing arguments to a function by reference
<?php
function inc(& $b) {
$b++;
}
$a = 1;
inc($a);
echo $a;
?>
Output:
2
A function may return a reference to data as opposed to a copy
<?php
function & get_data() {
$data = "Hello World";
return $data;
}
$foo = & get_data();
?>
__________________ Thanks & Regards
Sabari... |