Re: Static and Global at the same time!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, February 10, 2006 9:07 am, Miguel Guirao wrote:
> Can I have a variable that is static and global at the same time
> within a
> function?
> Let's say I have:
>
> $data = "";
>
> function newdata() {
>   static global $data;
>   $data [$i] = $newdatatobestored_inthearray;
> }

No.

But if you need external access, global is the way to go...

I can't think of any inherent property to 'static' that is not already
encompassed by 'global'...  Am I missing something?

Initializing $data to "" and then adding to it as an array is pretty
ugly code, imho.  Initialize it to an array() not "" if it's an array.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux