2fb7b0e279
Noticed this in perf, maybe I'm missing something obvious but it seemed like there was a pretty easy way to avoid an extra hashtable lookup during get_class_constants This shows up because the Enum class call this method once per enum the first time isValid is call. Might be worth doing something to make this even more efficient, but seems like an easy win.
16 linhas
278 B
PHP
16 linhas
278 B
PHP
<?
|
|
// Never True
|
|
if (rand(100,101) == 2) {
|
|
define("FOO", 1);
|
|
} else {
|
|
define("FOO", 2);
|
|
}
|
|
class Blah {
|
|
const DYNAMIC_VAL = FOO;
|
|
const STRING_VAL = "zzz";
|
|
const INT_VAL = 105;
|
|
const FP_VAL = 3.14;
|
|
const NULL_VAL = null;
|
|
}
|
|
var_dump(get_class_constants("Blah"));
|