6 ms·
The problem is that first class callables actually makes a new object wrapper for each reference, so trim(…) != trim(…). (It can be true in some cases, it depen
by joe_hoyle 8mo ago
The problem is that first class callables actually makes a new object wrapper for each reference, so trim(…) != trim(…). (It can be true in some cases, it depends if the memory is freed for the first reference).
- pwdisswordfishy 8mo agoAnd how is Closure::fromCallable('trim') recommended by the article any better in that respect? $ php8.4 -r "var_dump(Closure::fromCallable('trim') === Closure::fromCallable('trim'));" bool(false)
- joe_hoyle 8mo agoIt is not better, this is a problem with the first-class callable syntax altogether.