I have a session variable $_SESSION["customer"]
which contains one object of the customer class, which has private properties such as firstname, lastname and so on. They can be accessed but public getters and setters. I don't know how to access them and use them in my code.
Here is a var_dump of $_SESSION["customer"]
object(Customer)#4 (13) { ["id":"Customer":private]=> string(4) "1019" ["fname":"Customer":private]=> string(4) "john" ["lname":"Customer":private]=> string(3) "doe" ["dob":"Customer":private]=> string(10) "1999-12-12" ["address1":"Customer":private]=> string(10) "humberwood" ["address2":"Customer":private]=> string(0) "" ["city":"Customer":private]=> string(7) "toronto" ["zip":"Customer":private]=> string(6) "m3a1c6" ["province":"Customer":private]=> string(2) "ON" ["gender":"Customer":private]=> string(1) "0" ["email":"Customer":private]=> string(21) "johndoe@humbermail.ca" ["username":"Customer":private]=> string(6) "humber" ["password":"Customer":private]=> string(6) "humber" }
I tried using $username = $_SESSION["customer"]->Customer->getUsername();
but in vain