php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #15570 unset and static variables
Submitted: 2002-02-15 10:21 UTC Modified: 2002-02-15 10:43 UTC
From: ivan dot lamouret at novitek dot fr Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.1.1 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ivan dot lamouret at novitek dot fr
New email:
PHP Version: OS:

 

 [2002-02-15 10:21 UTC] ivan dot lamouret at novitek dot fr
The example about static variables in the  manual page for "unset" is broken : the output is actually 1 2 3 (not 1 1 1) there is no reset.

function foo() {
    static $a;
    $a++;
       echo "$a\n";

    unset($a);
}

foo();foo();foo()

From the discussion of bugs 2015, 6810, and 13967 it seems it is clearly an error in the doc.

Ivan

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-15 10:43 UTC] nohn@php.net
This bug has been fixed in CVS.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 06:01:38 2025 UTC