variable in a variable raspberry pi

65 views Asked by At

I was wondering if variable in a variable (I think it's called dynamic variable ) works in php while working on raspberry pi (raspbian OS), for example:

$a=${'slota'.$x1} * (${'slot'.$x3});

and if no, which is the best alternative?

1

There are 1 answers

0
CG_DEV On

Try

 $var1 = 'slota'.$x1;
 $var2 = 'slot'.$x3;

 $a = ($$var1 * $$var2);  /// these variables must already exists Im assuming