php - How to access a variable with random value inside a class? -


   class session{         protected $git =  md5(rand(1,6));          public function __construct($config = array())         {            //// code             $ses_id = $this->git;          }         public function _start_session()         {            //code again..         }       } 

here can't assign random value variable called git. how can if possible? random value need first time generated value till time converts null.

perform random inside constructor,

class session{         protected $git;          public function __construct($config = array())         {            //// code            $this->git =  md5(rand(1,6));            $ses_id = $this->git;          }         public function _start_session()         {            //code again..         }       } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -