-1

A php variable $a (which was set to a value earlier in the code) is being reset to a value of 0 and I don't want it to. At the end of the php code, I did an echo and $a was 0. So I made a debugging array to catch the value at various points. I found where it's getting set to 0. Here's the code:

$a = 1;
if($total> 0){  
  $a = ($a/$total);  
  $X["i"]=$a;    
}
$X["ii"]=$a;  

Output:
$x["i"]=1;
$x["ii"]=0;

A few things: There are no functions at all (and obviously not where it's being set to 0), and $a is a global. It's a very large php file. I'm wondering if memory is the problem...? No idea. I'm not a nube to php, or to programming.

4

1 回答 1

0

您正在设置大写 X 并输出小写 x

(如果这只是一个错字,请显示更多代码。例如输出代码。)

于 2013-04-13T22:45:13.523 回答