I have a variable, for example $total1. It has a value from the database, for example 6.
Now I do an SQL query and it gets some numbers from tables. For example this: $subtraction1=5, but it is in a while loop so the second time it could be $subtraction1=10 or something like that. Every time in the while loop the $subtraction_total variable would be $subtraction_total1+$subtraction1, because at the bottom of the page I would like to show the $total minus the $subtraction_total1.
但是,在排第一期间,第一次必须检查一下是否已经存在补贴——总额。 我知道有选择这样做,但路不短?
Option 1 is to define the variable $subtraction_total1 before the while loop.
备选案文2是:
(!isset($total_subtraction1)){$total_subtraction1=0;}$total_subtraction1=$total1-$subtraction1;
现在,你认为:选择1:界定1个变量是正确的,但对于大约15个变量,我只是想到的是,是否缩短了;
希望你们理解我,我的英语并不好;-