PHP 8.5.0 Alpha 4 available for testing

Voting

: min(four, three)?
(Example: nine)

The Note You're Voting On

jcastromail at yahoo dot es
4 years ago
I did a benchmark about env.

constants :
0.00067687034606934 ms
getenv :
0.056761026382446 ms

(less is better)

https://github.com/eftec/php-benchmarks#define--const--env

And, in Windows at leat, reading the env value is considerably slow (in comparison with a constant), so PHP doesn't cache the information and asks to the OS the env value per call.

So, if you are calling once per request, then there is not a problem. However, if you are calling it many times per request, then it could affects the performance.

<< Back to user notes page

To Top