You are here: Re: Don't unset that variable you need globally « PHP Language « IT news, forums, messages
Re: Don't unset that variable you need globally

Posted by Hilarion on 11/02/45 11:20

> hmmm...i don't believe you have mis-read anything. i read steve's op that
> same way you did *and* the problem he describes *does* conflict with the php
> manual. but then again, we may both be having problems with our reading
> comprehension. ;^)


:)

OK. The way I read it was:

> Say you have defined a variable $var in your main script.
>
> Now in a function you access it using:
> global $var;

I suppose the above text was clear and requires no translation.


> But you want to set it to null inside the function.

The above means "you want to unset global variable $var / set it
to null"


> DO: $var = null;
> DONT DO: unset($var);
>
> Why? Because the 2nd way removes the variable from the name space,

"Because the 2nd way removes the variable from current (function) namespace"


> and it is no longer globally available.

"You do not have acces to the global variable from current (function) scope."


> Cost me 10 hours....



Hilarion

PS.: The fact that English is not my native language is probably influencing
the way that I read it.

 

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

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