any way to iterate the fields in a class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux