I want to store courseworks marks of n courseworks into n variables, such as cw1 and cw2 etc. Using variable variables how can I come with cw1, cw2 etc.
How can I d
You should really use an array, as Gumbo wrote:
$cw = array(); for($i = 0; $i < $n; ++$i) { $cw[] = $something; }
However, a solution to your problem:
for($i = 0; $i < $n; ++$i) { $tmp = 'cw' . $i; $$tmp = $something; }