8000 Update dotenv.rst · symfony/symfony-docs@5be35bf · GitHub
[go: up one dir, main page]

Skip to content

Commit 5be35bf

Browse files
browner12wouterj
authored andcommitted
Update dotenv.rst
it seems standard practice is to no longer use `getenv()` due to it not being thread safe. symfony/symfony@21a909a Updated the docs to remove reference to that function. Would we want to go so far as to add a note to **not** use `getenv()`?
1 parent dbc77f5 commit 5be35bf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

components/dotenv.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The Dotenv Component
66
====================
77

< 8000 /td>
88
The Dotenv Component parses ``.env`` files to make environment variables
9-
stored in them accessible via ``getenv()``, ``$_ENV`` or ``$_SERVER``.
9+
stored in them accessible via ``$_ENV`` or ``$_SERVER``.
1010

1111
.. versionadded:: 3.3
1212

@@ -55,10 +55,10 @@ Given the following ``.env`` file content:
5555
DB_USER=root
5656
DB_PASS=pass
5757
58-
Access the value with ``getenv()`` in your code::
58+
Access the value with ``$_ENV`` in your code::
5959

60-
$dbUser = getenv('DB_USER');
61-
// you can also use ``$_ENV`` or ``$_SERVER``
60+
$dbUser = $_ENV['DB_USER'];
61+
// you can also use ``$_SERVER``
6262

6363
.. note::
6464

0 commit comments

Comments
 (0)
0