Hi, I am a newbie in PHP and I am asking wether I can initialize once for all data inside an object and use them later
<?
class Person(){
private $data;//private or public
function Person($data){
$this->data['name'] = $data['name'];
....
}
function save(){
$this->dbconn.executeQuery('insert into ... values('$this->data['name']',...));
//some object to connect and execute query on a database.
}
}
?>
$me = new Person(array(['name']=>'my fname my lname',...));
$me->save();
//print_r($me) shows that $data has no initialized values
How can I solve that problem. If you know a link where the same problem has been asked, please copy and paste it here. thank you.