What is the real need to create a variable with variable names in php? [duplicate]

0

A variável was created called bebida with its value being Refrigerante .

Then a variable of variable bebida was created with the value Guaraná .

Why use this, when can I simply create a drink variable and equate guarana?

<?php

    $bebida = "Refrigerante";
    $$bebida = "Guarana";

    echo $Refrigerante;

?>

Is there an example of actual usage in which it is necessary to use variable variables instead of the classic declaration of variables?

    
asked by anonymous 21.10.2018 / 18:31

0 answers