Is it possible to create variables programmatically?
Example ( this example does not work, it's just to understand the idea ):
I want to create the variables: $var0
, $var1
, $var2
, $var3
and print your name and value.
$qtdVariaveis = 5;
$prefixo = 'var';
$valorPadrao = 10;
for ($c = 0; $c < 5; $c++) {
echo $prefixo . $c = $valorPadrao;
}
Desired output:
$var0 = 10
$var1 = 10
$var2 = 10
$var3 = 10