My php math is not working -
i trying make simple division 2 numbers array this.
here array:
array ( [0] => array ( [day] => 2013-04-06 [hour] => 06 [hits] => 4 [executetime] => 10.0000 ) ) i dividing them this:
//### edit ###//
$thishour = date("h", time()); $thisdate = date("y-m-d", time()); $total_time = 2.5000; $movestats = $memcache->get('movestats'); foreach ($movestats $k => $v) { $movestats[$k]['hits']=$movestats[$k]['hits']+1; // updating hits $movestats[$k]['executetime'] += $total_time; $movestats[$k]['executetime'] = number_format($movestats[$k]['executetime'] / (++$movestats[$k]['hits']),4,'.',''); } $memcache->set('movestats', $movestats); this strangly enough gives me number: 1.75!
i guess should 2.5?
what doing wrong. please , in advance :-)
try
$movestats[$k]['executetime']=$movestats[$k]['executetime']+$total_time; instand of
$movestats[$k]['executetime']+$total_time;
Comments
Post a Comment