Re: Global value
| From: | Teodor Cimpoesu | Date: | Mon, 25 Sep 2000 07:38:11 +0000 |
| Subject: | Re: Global value | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-17417@lists.php.net to get a copy of this message | ||
Hi Roman!
On Wed, 20 Sep 2000, Roman A.Grigorovich wrote:
> Help me please!
> I am lost in documentation.
>
> Can I declare $var1 as global varaible
yap, just like in C. If you declare a var outside of any function it
will be automatically `global' (in C, extern linkage).
then, if you want to use it in a function u use something like
function fun() {
global $moo;
echo "hi $moo";
echo $GLOBALS['moo']; // same thing, except the previous imported $moo locally
}
> for all functions in my .php-script?
>
> --
> -=aTz=- mailto:atz@atz.msk.ru
> http://www.atz.msk.ru/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
-- teodor