Major problems with PHP4
Posted: Mon Aug 28, 2006 6:31 pm
Everah | Please use
Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
This code prints out "AB", and it should print out "AA". What's wrong with me?
PHP 4.4.2Code: Select all
<?php
class test
{
var $a="";
var $b="";
function testfunc()
{
$this->$a="A";
echo $this->$a;
$this->$b="B";
echo $this->$a;
}
}
$t=new test;
$t->testfunc();
?>Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]