|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7137 The unset function doesn't work inside a funcfion for a global var
Submitted: 2000-10-11 11:37 UTC Modified: 2000-10-11 11:56 UTC
From: laszloj at psi dot com Assigned:
Status: Closed Package: Variables related
PHP Version: 4.0.2 OS:
Private report: No CVE-ID: None
 [2000-10-11 11:37 UTC] laszloj at psi dot com
 function xx() {
  global $a;

 // stage 1 - unset works
 print "a= $a<br>";
 print "a= $a<br>";
 // stage 2 - unset doesn't work in function xx
 print "a= $a<br>";
 print "a= $a<br>";


My Result page:
a= 1
a= 2
a= 2  - it has to be empty because of previous unset

This script is working with PHP3.x


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-11 11:56 UTC]
FAQ. You cannot unset global. You should unset $GLOBALS["a"]. Please read "References Explained" in the manual, especially "Spotting References" and "Unsetting references".
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Oct 24 11:03:33 2021 UTC