You are here: Re: functions, which returns changes « PHP Programming Language « IT news, forums, messages
Re: functions, which returns changes

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация