It is perfectly legal to pass the variable by reference from one function to
another.  You'll see that $tmp is 2 at the end of this script. Ofcourse, if
you leave off the reference operators you'll end up with 0.

<?php

function a(&$tmp){
 $tmp++;
 b($tmp);
}

function b(&$tmp){
 $tmp++;
}

$tmp = 0;
a($tmp);

?>



"Carl Furst" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Ok lets see I have the following two functions one calls the other
>
> Function a (&$myref) {
>
> ..something... then calls function b
>
> b($myref);
>
> }
>
> function b (&$myref) {
>
> something
>
> }
>
> a($myref);
>
> is the reference by passing in function b legal???
>
>
>
> Carl Furst
> Chief Technical Officer
> Vote.com
> 50 Water St.
> South Norwalk, CT. 06854
> 203-854-9912 x.231
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to