MyBB Community Forums

Full Version: Unsetting Global slow?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Probably hopeless, but I'll try asking anyway.

On a PHP 4.3.11 server, I was a little befuddled with this:
PHP Code:
function somefunction()
{
 global 
$somevariable;
 if(
is_array($somevariable))
 {
  
// do some stuff
  
unset($GLOBALS['somevariable']);
 }


The above code would basically cause the script to run forever (well, the page would never load).
I found the issue to be the unset() statement - commenting it out, the script would run fine.

Anyone have any ideas as to why this happens?
PHP bug?
I really don't know - I tried a few keywords in Google, but was fruitless...

BTW, both these work fine:
PHP Code:
// gets rid of local reference
unset($somevariable);
// I think this is the same as unset??
$GLOBALS['somevariable'] = null

Odd eh?
Reference URL's