Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

global $a in PHP is just another way to write $a =& $GLOBALS['a'];

I.e. you just create reference to a global variable. Unsetting reference just breaks the tie between variable name and content.



Exactly, which means that unset( $a ) is not the same thing as unset( $GLOBALS['a'] ). It makes perfect sense, just not a kind of thing you might not expect at first.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: