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
 [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

Add a Patch

Pull Requests

Add a Pull Request

History

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