your close.
<?php
function f_of_A($var)
{
$var +=1;
}
function f_of_B($var)
{
$var %=3;
}
function do_both($vara, $varb)
{
f_of_A(&$vara);
f_of_B(&$varb);
}
$gvara = 12;
$gvarb = 13;
do_both(&$gvara, &$gvarb);
?>
the '&' goes in front of the variable being given, not in the function args.
--
Chris Lee
[EMAIL PROTECTED]
"Dennis Gearon" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I want to be able to do this:
>
> function f_of_A( &$vara ){
> $var +=1;
> }
>
> function f_of_B( &$varb ){
> $var %=3;
> }
>
> function do_both( &$vara, &$varb ){
> f_of_A( $vara );
> f_of_B( $varb );
> }
>
> $gvara=some_number;
> $gvarb=some_other_number;
>
> do_both( $gvara, $gvarb );
>
> and have the original, global variables altered by the 'f_of_X'
> functions.
>
> The above structure and use of the '&' symbol DID NOT WORK, any ideas
> why the
> reference to the real contents did not get passed down?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]