1
There is the possibility to create variables programmatically?
Example (this example does not work, it is only 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 exit:
$var0 = 10
$var1 = 10
$var2 = 10
$var3 = 10
Would that be
${$prefixo . $c} = $valorPadrao;
?– Valdeir Psr
@Valdeirpsr yes, only the name of the variable had to be printed. There is this function ?
– rbz
It’s the same thing.
echo ${$prefixo . $c}
– Valdeir Psr