note 125403 added to function.getenv
| From: | jcastromail.yahoo.es via php-notes | Date: | Wed, 30 Sep 2020 20:45:21 +0000 |
| Subject: | note 125403 added to function.getenv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-215499@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 45.112.84.4
Probable Submitter: 177.234.144.170 (proxied: 190.46.238.9)
----
Manual Page -- http://php.net/manual/en/function.getenv.php
Edit -- https://master.php.net/note/edit/125403
Del: integrated -- https://master.php.net/note/delete/125403/integrated
Del: useless -- https://master.php.net/note/delete/125403/useless
Del: bad code -- https://master.php.net/note/delete/125403/bad+code
Del: spam -- https://master.php.net/note/delete/125403/spam
Del: non-english -- https://master.php.net/note/delete/125403/non-english
Del: in docs -- https://master.php.net/note/delete/125403/in+docs
Del: other reasons-- https://master.php.net/note/delete/125403
Reject -- https://master.php.net/note/reject/125403
Search -- https://master.php.net/manage/user-notes.php