Robert Dyke wrote:
> Hi ... PHP newbie here.
>
> I'm migrating from ASP/vbScript.
>
> I'd like to set up a subroutine that will change several variables at
> once.
>
> In VB, I can say:
>
> Private Sub Change_Variables ($variable1, $variable2)
>     $variable1 = "Something different from it's original value"
>     $variable2 = "I'm changed also!!"
> End Sub
>
> // in my code I can call it like this:
> $My_variable1 = "This is the original value of variable1"
> $My_variable2 = "This is the original value of variable2"
>
> Call Change_Variables ($My_variable1, $My_variable2)
>
> // after calling this subroutine the variables are changed:
>
> print $My_variable1  // yeilds: "Something different from it's
> original value"
> print $My_variable2  // yields: "I'm changed also!!"
>
> I try to convert this to PHP, and I'm getting stuck.  I'm sure
> there's a kind of function that can do this.
>
> Any ideas?

VB defaults to pass by reference while PHP defaults to pass by
value.

Read more at: http://www.php.net/manual/en/language.references.pass.php

  Jome



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

Reply via email to