php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19478 Two classes error
Submitted: 2002-09-18 11:26 UTC Modified: 2002-10-03 05:46 UTC
From: to at andybutkaj dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.2.2 OS: Windows 2000 and Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: to at andybutkaj dot com
New email:
PHP Version: OS:

 

 [2002-09-18 11:26 UTC] to at andybutkaj dot com
    class test
    {
        var $_value;

        function test_static ($to)
        {
            $this->_value = $to;
        }
    }


    class test2
    {
        var $_value;

        function use_test ()
        {
            $this->_value = 7;

            $y = new test();
            $y->test_static(5);
            echo "<p>value: ".$this->_value."</p>";

            test::test_static (5);
            echo "<p>value: ".$this->_value."</p>";

        }
    }

    $x=new test2();
    $x->use_test();

First echo returns value 7
Second echo returns value 5

is this correct?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-03 04:47 UTC] k.schroeder@php.net
Yes it is. To get 5 for the first example, you must output the value of $y->_value.

Regards, Kai
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Oct 27 05:03:35 2021 UTC