Is it possibile to initialize an object`s properties, with a simple action? I mean I have a class with 5 properties.
For example:
class CClass
{
$one;
$two;
$three;
$four;
$five;
function CClass()
{
$array = array(1,2,3,4,5);
...
}
}
And I`d like to initialize the properties, with the walues contained in the array, but I don`t want to use method below.
$this->one=$array[1];
$this->two=$array[2];
...
I know, there is a get_class_vars() PHP function, which copies the properties keys/values into an array. But I`d like to initialize the properties, with items in an array with a 'for' statement, in a simple step.
Is it possibile in PHP?
Thanks.
For example:
class CClass
{
$one;
$two;
$three;
$four;
$five;
function CClass()
{
$array = array(1,2,3,4,5);
...
}
}
And I`d like to initialize the properties, with the walues contained in the array, but I don`t want to use method below.
$this->one=$array[1];
$this->two=$array[2];
...
I know, there is a get_class_vars() PHP function, which copies the properties keys/values into an array. But I`d like to initialize the properties, with items in an array with a 'for' statement, in a simple step.
Is it possibile in PHP?
Thanks.