Posted by ZeldorBlat on 10/26/06 13:05
Sonnich wrote:
> Note the var.
> I want to pass on a variable, which is changed in the subroutine.
>
> so::
>
> $i = 54;
> blabla($i);
> $i is is now 55
>
> S
>
>
> Jay wrote:
> > I'm not sure what you mean
> >
> > $something_to_be_updated;
> >
> > function update() {
> > global $something_to_be_updated;
> > $something_to_be_updated++;
> > }
> >
> > or
> >
> > function update($something_to_be_updated) {
> > return $something_to_be_updated++;
> > }
> >
> >
> > Sonnich wrote:
> > > Geee cannot remomber
> > >
> > > I'd like to do this:
> > >
> > > function blabla(var $something_to_be_updated)
> > > {
> > > $something_to_be_updated++;
> > > }
> > >
> > > but it is not var. How do I do this?
> > >
> > > Is there a better way than a function for this?
> > >
> > > s
You want this:
function blabla(&$something_to_be_updated) {
$something_to_be_updated++;
}
Read this:
<http://www.php.net/manual/en/language.references.pass.php>
Navigation:
[Reply to this message]
|