Actually, what I am seeking is how to assign values to the fields in a class
via an array.
I have tried like this. However failed.
I have a class.
*class book{
var name;*
*var price;*
*}*
*
*
And I have got an array.

*$array=array('name'=>'harry potter','price'=>'$122');*

By using function *extract(), *I assign the values to $name and $price while
not $this->name and $this->price, which is not what I want.

So I am thinking iterating the fields in an array and assign the values each
by each through an array.

Is there any way to assign values to the fields in a class via an array.

Thanks in advance!

Reply via email to