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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
41 - 6 = ?
Subscribe to this entry?

 
 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 01:01:30 2024 UTC