note 123599 added to language.variables.variable
| From: | marcin dot dzdza at gmail dot com | Date: | Sun, 10 Feb 2019 23:59:43 +0000 |
| Subject: | note 123599 added to language.variables.variable | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-210226@lists.php.net to get a copy of this message | ||
The feature of variable variable names is welcome, but it should be avoided when possible. Modern
IDE software fails to interpret such variables correctly, regular find/replace also fails. It's
a kind of magic :) This may really make it hard to refactor code. Imagine you want to rename
variable $username to $userName and try to find all occurrences of $username in code by checking
"$userName". You may easily omit:
$a = 'username';
echo $$a;
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.142 (proxied: 2a02:a318:c33e:e880:dd4d:faf3:e459:177a)
----
Manual Page -- http://php.net/manual/en/language.variables.variable.php
Edit -- https://master.php.net/note/edit/123599
Del: integrated -- https://master.php.net/note/delete/123599/integrated
Del: useless -- https://master.php.net/note/delete/123599/useless
Del: bad code -- https://master.php.net/note/delete/123599/bad+code
Del: spam -- https://master.php.net/note/delete/123599/spam
Del: non-english -- https://master.php.net/note/delete/123599/non-english
Del: in docs -- https://master.php.net/note/delete/123599/in+docs
Del: other reasons-- https://master.php.net/note/delete/123599
Reject -- https://master.php.net/note/reject/123599
Search -- https://master.php.net/manage/user-notes.php