Please bear with me I am a PHP hacker and not a coder....yet.
Anyhow, I am trying to simplify some current code that I have to make it easier to update. I have a set of variables that I define in my code that increment from 1..2..3..4 in order depending on the section and want to make it into a for loop that I can just set the start number and ending number for each section.
Currently...
and I would like to have something like this..Code:$question1 = $REProw['quest_1']; $question2 = $REProw['quest_2']; $question3 = $REProw['quest_3']; $question4 = $REProw['quest_4']; ... $total=abs($question1) + abs($question2)...
As you can see I haven't gotten far so any help in finishing this would be appreciated.Code:$totalI = 0; for ($i=1;$i <= 21; $i++){ $totalI = $totalI + ${"question".$i}; }





Bookmarks