php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9164 wrong variable is initialized
Submitted: 2001-02-07 16:21 UTC Modified: 2001-02-07 16:27 UTC
From: di99otmi at hd dot chalmers dot se Assigned: waldschrott (profile)
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.0.3pl1 OS: slackware 7.1
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: di99otmi at hd dot chalmers dot se
New email:
PHP Version: OS:

 

 [2001-02-07 16:21 UTC] di99otmi at hd dot chalmers dot se
function Bjbase($antal){  
    $this->$lekar=$antal;
    $this->$dragna=array();
    $this->$ess=58;
    echo $this->$dragna;
  }

this is a constructor

the echo statement prints 58 even though that it is $ess that is initialized to 58.
The variable $dragna is not treated as an array anywhere but when the $ess line is gone it works fine.
tried at another server too.
is this a problem you know of?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-07 16:26 UTC] jmoore@php.net
Your code is incorrect, try this:

function Bjbase($antal){  
    $this->lekar=$antal;
    $this->dragna=array();
    $this->ess=58;
    echo $this->dragna;
  }

 [2001-02-07 16:27 UTC] waldschrott@php.net
please read the manual on how to use class members
hint: the second $ sign is _not_ needed
$this->variable='foo';

 [2011-08-07 05:20 UTC] gwynne@php.net
Automatic comment from SVN on behalf of gwynne
Revision: http://svn.php.net/viewvc/?view=revision&revision=314400
Log: Fix build under Clang 2.9 - see LLVM bug #9164 (http://llvm.org/bugs/show_bug.cgi?id=9164). Tested with GCC and Clang on Darwin and Ubuntu.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 10:01:28 2024 UTC