Reply to Re: Function with reference-passed variabel

Your name:

Reply:


Posted by Johnny on 09/26/06 18:27

"Oli Filth" <catch@olifilth.co.uk> wrote in message
news:PV7Sg.47145$7D6.28026@newsfe2-win.ntli.net...
> The87Boy said the following on 26/09/2006 12:04:
> > Are there somebody, who can tell me, what I'm doing wrong with this
> > function:
> > function hej($q, &$h) {
> > if ($q == 0) {
> > return true;
> > $h = 'Hello';
> > } else {
> > return false;
> > $h = 'Goodbye';
> > }
> > }
> >
> > $rt = hej(0, &$a);
> > if ($rt==true) { echo 'Hej'; }
> > else { echo 'Farvel'; }
> > print_r($a);
> > echo "<br />\n";
> >
>
> You are returning from the function before $h is set.
>
> --
> Oli

also you don't need to use the & when you call the function, only when you
define it:
http://us2.php.net/manual/en/language.references.pass.php

[Back to original 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

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