|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13884 Arrays does not work good in objects
Submitted: 2001-10-31 06:17 UTC Modified: 2001-10-31 13:08 UTC
From: starky at udm dot ru Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.0.6 OS: Win98
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.
Bug Type:
From: starky at udm dot ru
New email:
PHP Version: OS:


 [2001-10-31 06:17 UTC] starky at udm dot ru
 class test{
  var $items;
  function test1(){
 $test=new test;
 echo $test->$items['bar'];
last line will output "test"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-31 13:08 UTC]

HINT: You should not be using a $

WRONG : $this->$items['foo']='test';
RIGHT : $this->items['foo']='test';

WRONG : echo $test->$items['bar']; (unless you had a global items array with items['bar'] = "items['foo']")
RIGHT : echo $test->items['bar'];

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Jun 01 18:03:35 2023 UTC