php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1473 String assignement in class
Submitted: 1999-05-30 12:06 UTC Modified: 1999-05-30 12:10 UTC
From: andraax at cybercable dot fr Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.7 OS: Linux 2.2.5-15 Redhat
Private report: No CVE-ID: None
 [1999-05-30 12:06 UTC] andraax at cybercable dot fr
let's see this code:

class dummy{
    var $yes ;
    var $no ;

    function dummy($y, $n ) {
        $this->$yes = $y ;
        $this->$no = $n ;
        print "Y=$y|YES=".$this->$yes."|N=$n|NO=".$this->$no."<BR>" ;
    }
}

$test = new dummy("ab", "cd") ;
//OUPUT =Y=ab|YES=cd|N=cd|NO=cd !!!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-05-30 12:10 UTC] andrey at cvs dot php dot net
You have to refer to class variables without $, e.g. $this->yes not $this->$yes.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 06:00:01 2026 UTC