在php中为现有变量创建变量名

Hi i have a variables that names are

$variable1='content1' , $variable2='content2' , $variable3='content3';

and i need to loop for using that contents and index for that; example;

$index=3;
for($i=0;$i<=$index;$i++){

  $sql="insert into table values("'variable'.$i,$i")on duplicate key update variable=values(variable),controlValueThatIs$i=values(controlValueThatIs$i)";
  $mysqli_query($con,$sql);
}

Is that work?

you can try this

$str = 'variable'.$i;

echo $$str;

the problem is quote (') you should use it along with whole variable name like this -

values("'variable".$i."')