You are here: Re: Function with reference-passed variabel « PHP Programming Language « IT news, forums, messages
Re: Function with reference-passed variabel

Posted by Oli Filth on 09/26/06 11:11

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

 

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

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