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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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: Sat Nov 27 06:03:14 2021 UTC