|
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
Navigation:
[Reply to this message]
|