what is problem in my php class | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is problem in my php class

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

17th Apr 2019, 1:30 PM
Satish Kumar Sharma
Satish Kumar Sharma - avatar
1 Answer
0
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"); }
17th Apr 2019, 2:18 PM
Bahhaⵣ
Bahhaⵣ - avatar