Re: PHP newbie ... function with several returns ?
| From: | Robert Dyke | Date: | Sun, 16 Mar 2003 01:13:32 +0000 |
| Subject: | Re: PHP newbie ... function with several returns ? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139821@lists.php.net to get a copy of this message | ||
"Jome" <jome@emoj.net> wrote in message
news:20030316010053.98539.qmail@pb1.pair.com...
> 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
THANKS!! I inserted the ampersands and it works beautifully ...