Hi All,

For building variables in procedural php, we can build ${"abc".$i}

Can we do a similar thing for assigning values to properties of an object

For eg: $obj is an instance of a Class, which has x number of variables

The following things do NOT work:

1)
while(list($key, $val) = each($_POST))
{
    $obj->$key=$val;
}


2)
while(list($key, $val) = each($_POST))
{
    ${"obj->".$key}=$val;
}


3)
while(list($key, $val) = each($_POST))
{
    $obj->{$key}=$val;
}


Are there any alternative to this?

Thanks in advance.

Regards,
Tapan
-- 
Tapan Shah
http://www.tapan.in/
http://www.assetonline.in/


[Non-text portions of this message have been removed]

Reply via email to