Adding Class Properties At Runtime
Posted: Fri Sep 16, 2005 2:39 am
Hi, I observed this morning that I can add additional class properties at runtime, without any error produced.
Is it normal or a bug?
This will output
Is it normal or a bug?
Code: Select all
class A
{
var $var1;
function AddVar2(){
$this->var2 = 0;
}
}
$b = new A;
print_r($b);
echo "<br>";
$b->AddVar2();
print_r($b);I'm using PHP 4.4.0My Screen wrote: a Object ( [var1] => )
a Object ( [var1] => [var2] => 0 )