Variables: when is it useful?

Possible duplicate:
What is the actual use of variable variables?

Well, this question may seem a bit accurate - bad, but I would really like to know: when are variable variables useful? I have been programming in PHP for several years, but I have never used them. For me it looks rather funny than useful.

What are real life examples of variable variables?

Update:

I am very sorry for your votes. The associated “duplicate” can really be a hoax, except for one thing: the examples here show me why not use variable variables .

+3
source share
3

. , , , ..

+7

, MVC View.

foreach ($this->vars as $key => $value)
{
    // some test would be here so there are no conflicts
    $$key = $value;
}

.

, . , .

+1

. PHP .

0

Source: https://habr.com/ru/post/1761875/


All Articles