what is problem in my php class

I get error when I store date in variable https://code.sololearn.com/wqCvHs8Y0xWw/?ref=app

4/17/2019 1:30:04 PM


1 Answer

New Answer


the problem is that you are trying to use a class property that's dynamically evaluated at runtime. the date function should be initialized inside the constructor. something like : public $dt ; public function __construct(){ $this->dt = date("h:i:s"); }