Code: Select all
while (list($k,$v)=each($lines))
{
$gb = new Class1($v);
// display $gb contents
}Code: Select all
$gb = new Class1();
while (list($k,$v)=each($lines))
{
$gb->set($v);
// display $gb contents
}This how my contructor is :
Code: Select all
function Class1($Id=-1)
{
if ($Id!=-1)
$this->set($Id);
}
function set($Id)
{
$this->var1 = $Id;
$this->func();
}Code1 works ok but Code2 displays the first row ok and the rest of the rows having row1's value.
Anyone know how this works ?
Using PHP 4 not PHP 5.
Thanks