when $i = 4, im trying to get the sum of the values and store it in a variable but idk how. im using variable variables..
for($i = 0; $i < 5; $i++) {
$varname = 'testimonyletters_'.$i.'';
if (preg_match('|<td class="'.$i.' page" style="background-color:#ccc"><a href="'.$url.'">(.*)</a></td>
<td class="'.$i.' sum">(.*)</td>|Ui',$stats,$result)) {
$$varname = $result[2];
}
if ($i == 4) {
$$varname = ($varname_1+$varname_2+$varname_3);
}
}
i would like the $testimonyletters_4 variable to be the sum of the previous variables 1-3. when $i == 4, my current code is not working. any idea how to fix this?