Although I reported this in the early days of php4 release as a migration problem, it has yet to appear in the manual. So add this note to clarify things for newcomers to php4 conversions.
An apparent parser change occurred between php3 and php4 to the function unset(). There are now lots of maybe confusing comments about this in the manual under this functions page which you should read.
To clarify an important difference which I spotted, the behaviour of unset() when used within a function on static or global variables gives quite different effects. In php3 the values of such variables were simply reset whereas now the variable is completely removed and any subsequent reference to the same variable name results in a completely new variable being defined - ie. a local function variable is created.
Some misunderstandings about the original php3 function are obvious amongst non-php authors. Quite possibly the present php4 interpretation is what was originally intended in php3, but since it was not implemented in this way can give rise to shocks when the same scripts are run under php4.
e.g.
function foo()
{
global $bar;
// at this point $bar is global
$bar="assign this string";
unset($bar);
// at this point $bar is local
$bar="overwrite string";
// so this assignment does not affect the global}
foo(); echo $bar;
Under php3 you would get "overwrite string", but under php4 "assign this string".
A similar difference occurs using unset to wipe out an array. The variable is no longer an array, and the memory used by the array is not released for re-use. You are advised to replace any uses of:
unset($arr);
by instead
$arr=array();