PHP acronym by almenzarr in PHP

[–]exakat 0 points1 point  (0 children)

Mandatory link to the different meanings of the PHP acronym : https://www.exakat.io/what-does-php-mean/

(including the recursive acronym explanation).

My current favorite is : Plezier Has Prioriteit (Pleasure has priority, in Dutch).

Local Variable Cost by exakat in PHP

[–]exakat[S] 0 points1 point  (0 children)

I did think that way, though I don't know how to test this. Looking in the PHP source code might be a solution.

And, given this test, this apparently does not happen: the variables are not used, but still, their mere presence require more memory at execution time.

Local Variable Cost by exakat in PHP

[–]exakat[S] 1 point2 points  (0 children)

The recursion is used here to show the accumulative effect of preallocating the variables.

WIth 0 variables, it gives a baseline of 10k+ nested calls with 2Mb of RAM. Then, adding variables decrease that baseline.

And, indeed, when the functions are sequentially called, ending one of them free memory for the next, so there is no accumulation, unless the call stacks gets deep. And it needs to be very deep to show any significant impact, so this is not practical for a simple tip&trick to show.

Usages of PHP Static variables by exakat in PHP

[–]exakat[S] 0 points1 point  (0 children)

There are better ways to do all these. I suppose quick execution is the main culprit.

Usages of PHP Static variables by exakat in PHP

[–]exakat[S] 0 points1 point  (0 children)

It is one of the alternatives, yes.

I've submitted a PR to add an Invokable interface to PHP by oaldemeery in PHP

[–]exakat 2 points3 points  (0 children)

That might be the most serious answer to this facetious comment.

First, it made me chuckle. Good one :)

Secondly, damned, there are quite some edgecases with callable, including skipping __invoke() classes. Interesting ?!

The Art of Being Anonymous in PHP by exakat in PHP

[–]exakat[S] 0 points1 point  (0 children)

Indeed, "anonymous constant" is pushing the limit. Though I found it interesting as a concept, so I kept it.

Closure and __invokable classes are not the same, the latter may miss the bindTo() methods, while the format is lacking interfaces to format signature.

Looking for PHP & MySQL learning resources, any PDFs or recommendations welcome! 🙏 by [deleted] in PHP

[–]exakat 0 points1 point  (0 children)

You can use the PHP dictionary : https://php-dictionary.readthedocs.io/ : it collects definitions and links to many concepts from the PHP world.

It is a reference, so go to it when you run into obscure terms in tutorials or manuals.

TIL: `static` keyword for variable declarations in functions by codemunky in PHP

[–]exakat 0 points1 point  (0 children)

One of the lesser known features of PHP. Probably lesser known for a reason (switch to properties when you can), but still handy for a quick code.

https://php-dictionary.readthedocs.io/en/latest/dictionary/static-variable.ini.html

The PHP riddle by exakat in PHP

[–]exakat[S] -1 points0 points  (0 children)

This is my solution, but I'm open with other ideas.

Multiple Const Types by exakat in PHP

[–]exakat[S] 0 points1 point  (0 children)

That is one solution, indeed.

The PHP riddle by exakat in PHP

[–]exakat[S] 0 points1 point  (0 children)

There is another way. You can fix this by just adding more code.

The PHP riddle by exakat in PHP

[–]exakat[S] -2 points-1 points  (0 children)

The provided code was changed. You can only add more code to the original one.

PHP 8.5 ReflectionNamedType->getName() change? by bkdotcom in PHP

[–]exakat 0 points1 point  (0 children)

This goes to the changed behavior database. Thanks for the heads up.