title: display message if time difference is greater than 50 minutes - php
body: <p>Basically i'm getting time difference between current time and database time.</p>
  
  <pre><code>  $cur_time = time();
    $db_time = $rs[$k]['update_time'];
    $diff = abs($cur_time - $db_time);
  
    $months  = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); 
    $days    = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
    $hours   = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); 
    $minutes  = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); 
    $seconds = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minuts*60));
  </code></pre>
  
  <p>Then to display the time diff in minutes, hours, days etc</p>
  
  <pre><code>if($hours!= 0)
    {
          if($hours== 1)
          {
              $time2 = $hours.' hour, ';
          }
          else
          {
              $time2 = $hours.' hours, ';
          }
  
    }
    else
    {
          $time2 = '';
    }
    if($minutes!= 0)
    {
          if($minutes== 1)
          {
              $time3 = $minuts.' minute, ';
          }
          else
          {
              $time3 = $minuts.' minutes, ';
          }
  
    }
    else
    {
          $time3 = '';
    }
  </code></pre>
  
  <p>same for seconds, days and months .. Then to display total time difference,</p>
  
  <pre><code>$timediff = $time1.$time2.$time3.$time4.' ago';
  </code></pre>
  
  <p>If my minutes is greater than 50 , I need to show message else another message. </p>
  
  <pre><code>if($time3 &gt; 50 || $time4 &gt; 1 || $time3 &gt; 1 || $time2 &gt; 1 || $time1 &gt; 1)
  {
      $msg = 'greater';
  }
  else
  {
      $msg = 'lesser';
  }
  </code></pre>
  
  <p>Problem is - Minutes, Hours, days are stored in seperate variable. For suppose, if my time difference is 55 minutes, which is showing</p>
  
  <pre><code>55 minutes ago
  </code></pre>
  
  <p>my condition is going to <strong>if condition</strong> which is correct. And if my time difference is  1 hour 2 minutes</p>
  
  <pre><code> 1 hour 2 minutes ago
  </code></pre>
  
  <p>my condition is again going to <strong>if condition</strong> considering only 2 minutes which is lesser than 50 min, rather it should go to else loop. How to put conditions for these time differences</p>