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
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");
}