Hi,
I have a problem regarding assign session variable to class variable while initialize the class variable.
Check my below code
<?php
class ModifyProfile
{
var $userType=$_SESSION['wb_user_type'];
var $tablename=WB_CUSTOMER_TABLE;
var $primarykey="nCustomerID";
}
?>
When i run the above code by creating this class object. its giving the parse error for php.
But when i have declare the first variable to blank then its working fine. Please check the code which is working.
<?php
class ModifyProfile
{
var $userType='';
var $tablename=WB_CUSTOMER_TABLE;
var $primarykey="nCustomerID";
}
?>
so can i assign the session variable to class variable as above or not.
EDIT:
What is the use of public, private and protected keyword while declaring class variable? I am running on php5.
Thanks