Mar-02-2022, 10:51 PM
For getting data from MySQL and displaying it in my output.php, I dynamically create PHP variables
The I have PHP variables like: $Q1 , $Q2 ... These arre then passed to a function as the offset names of the data arrays collected from MySQL
I was just wondering, is it possible to dynamically create variables in Python? Just out of interest.
Quote:$i = 0;
$j = 0;
foreach($allQsdata as $Qsdata) {
++$i;
$Qnr = 'Q' . $i;
${'Q'.$i} = $questions[$j];
++$j;
// other stuff
}
The I have PHP variables like: $Q1 , $Q2 ... These arre then passed to a function as the offset names of the data arrays collected from MySQL
I was just wondering, is it possible to dynamically create variables in Python? Just out of interest.