How do you pass a variable by Reference?
Posted by Raj
Example:
<?php
function test (&$a)
{
$a++;
}
$b=10;
test ($b);
// $b is 11 here
?>
You can assign default value to pass-by-reference paramter.
<?php
function test(&$arg = 1) {
if ($arg == 1) {
echo $arg;
}
}
test();
?>
This entry was posted on October 4, 2009 at 12:14 pm, and is filed under
how do i learn php,
how do you pass a variable by Reference,
how to create a php form,
local var,
PHP,
Question,
var values
.You can leave a response, or trackback from your own site.