In php: what is "+=" used for when comparing variables?

  • Thread starter Thread starter hotortillas
  • Start date Start date
H

hotortillas

Guest
I have this pice of code:

function calculateRanking()
{
$created = $this->getCreated();

$diff = $this->getTimeDifference($created, date('F d, Y h:i:s A'));

$time = $diff['days'] * 24;
$time = $diff['hours'];
$time += ($diff['minutes'] / 60);
$time += (($diff['seconds'] / 60)/60);

$base = $time + 2;

$this->ranking = ($this->points - 1) / pow($base, 1.5);

$this->save();
}

I do not get why there are 4 assignments for $time.
 
+= has nothing to do with comparison. It's an assignment operator.

x = x + 1
is the same as
x += 1
 
Back
Top