ID: 27776 Updated by: [EMAIL PROTECTED] Reported By: pedja at uzice dot net -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: Windows XP PHP Version: 4.3.4 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php not a bug. Previous Comments: ------------------------------------------------------------------------ [2004-03-30 08:39:09] pedja at uzice dot net Hmm... i found out what was the problem. Instead of $this->$testarray[$counter] i should use $this->testarray[$counter] ------------------------------------------------------------------------ [2004-03-30 08:32:14] pedja at uzice dot net Description: ------------ I created array as class property. It does not work as expected. Here is an example: <?php class testclass { var $testarray = array(); function testclass() { for ($counter = 65; $counter < 75; $counter++) { $this->$testarray[$counter] = chr ($counter); } } } $testvar = new testclass(); print_r ($testvar->$testarray); ?> The result of this code is array containing one record. It should contain several records. If I cahnge this code to use global variable instead of class property ... <?php class testclass { function testclass() { global $testarray; for ($counter = 65; $counter < 75; $counter++) { $testarray[$counter] = chr ($counter); } } } $testvar = new testclass(); print_r ($testarray); ?> ... it works: I get what I expected - array containing several records. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27776&edit=1