2021-04-28 16:49:39 +02:00
|
|
|
PHP's "variable variables" feature (dynamically-named variables) is temptingly powerful, but can lead to unmaintainable code.
|
|
|
|
|
2021-04-28 18:08:03 +02:00
|
|
|
|
2021-04-28 16:49:39 +02:00
|
|
|
== Noncompliant Code Example
|
|
|
|
|
|
|
|
----
|
|
|
|
$var = 'foo';
|
|
|
|
$$var = 'bar'; //Noncompliant
|
|
|
|
$$$var = 'hello'; //Noncompliant
|
|
|
|
|
|
|
|
echo $foo; //will display 'bar'
|
|
|
|
echo $bar; //will display 'hello'
|
|
|
|
----
|
2021-04-28 18:08:03 +02:00
|
|
|
|
2021-06-02 20:44:38 +02:00
|
|
|
|
|
|
|
ifdef::rspecator-view[]
|
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
|
|
|
include::comments-and-links.adoc[]
|
|
|
|
endif::rspecator-view[]
|