You are here: Re: how do I make a variable global « PHP Programming Language « IT news, forums, messages
Re: how do I make a variable global

Posted by windandwaves on 01/08/06 00:28

Steve wrote:
> On Sun, 08 Jan 2006 10:33:00 +1300, windandwaves wrote:
>
>> Hi Folk
>>
>> Consider this:
>>
>> ---foo1.php
>> $myvar = 10;
>>
>> --- foo2.php
>> require_once("foo1.php");
>>
>> function funky {
>> echo $myvar;
>> }
>>
>> from my experience, funky does not print 10. How do I make $myvar
>> "global" (not sure if this is the right word) so that it shows
>> everywhere.
>
> A search on global might have helped (:
> <?
>
> $myvar = 10;
>
> function funky ()
> {
> global $myvar;
> echo $myvar;
> }
>
> funky ();

Thanks Steve,

Sorry, yes, I did do the search on global, but I never really understood it
very well. Thank you again.

 

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

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