when studying oop in PHP, I noticed that the property declaration takes an array as the value, the PHP documentation mentioned here
class Test{
public $var7 = array(true, false);
}
and I noticed that the documentation says:
This declaration may include initialization, but this initialization must be a constant value, that is, it must be able to be evaluated at compile time and should not depend on runtime information for evaluation.
and after reading this , to find out how the compilation process works, I realized that during the compilation process, some expressions will be evaluated and optimized, if possible, as the snippet below:
var x = strlen ("testing") => int(7);
, , , , ?
Class Test {
public $vars=strlen("random");
}