What is += used for?

前端 未结 11 1921
醉酒成梦
醉酒成梦 2021-01-12 02:00

I think this is a dumb question but I could not find it on php. Why is a + with the = in the following code:

function calculateRanking()
{
    $created = $th         


        
11条回答
  •  滥情空心
    2021-01-12 02:31

    According to your code

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

    are similar to the following:-

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

提交回复
热议问题