Define data members within constructor
- by bertsisterwanda
I have got this little snippet of code, I want to be able to define each array element as a new data member.
class Core_User
{
protected $data_memebers = array(
'id' = '%d',
'email' = '"%s"',
'password' = '"%s"',
'title' = '"%s"',
'first_name' = '"%s"',
'last_name' = '"%s"',
'time_added' = '%d' ,
'time_modified' = '%d' ,
);
function __construct($id = 0, $data = NULL)
{
foreach($data_memebers as $member){
//protected new data member
}
}