I was curious when I first tried PHP, I just heard the term variable function, when I wanted to try it in class, the code was like this:
<?php
class example{
var $func = function () {
return 1 + 2;
};
var $fn = fn() => 1+2;
}
its give error : PHP Fatal error: Constant expression contains invalid operations in /var/www/html/phpmvc/latihan.php on line 4
is arrow function or anonymous function actually cant declare in class?
iam New btw