Reply to Re: Using variables in Two Function?

Your name:

Reply:


Posted by David Haynes on 05/22/06 17:16

Barkster wrote:
> This is the simplified way I have it now:
>
> $var = true;
> $var2 = 2;
>
> function getval() {
> display();
> }
>
> function display() {
> if($var) echo 'true' //not getting a value for $var?
> }
>
> <body>
> </php getval(); ?>
> </body>
>
As others have said, there are many ways to do this. Either:

function display($var) {
if( $var ) echo 'true';
]

would work, or:

function display() {
global $var;
if( $var ) echo 'true';
}

would also work.

-david-

[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

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