title: A confusion about time() function in PHP
body: <p>I cannot understand why the result of subtracting the current time from the variable of <code>$_session['now']</code> that has included the previous time is zero.</p>
  <hr />
  <p>I expected outputting the difference between the current time and the time when i have created the variable <code>$student-&gt;now</code>. Explain me please.</p>
  <pre><code>class Student
  {
  
      public function __set($key, $value)
      {
          $_SESSION[$key] = $value ;
      }
  
  
      public function __get($key)
      {
          return $_SESSION[$key];
  
      }
  
  }
  session_start();
  
  $student = new Student() ;
  
  //__set function will be called ;
  $student-&gt;now = time();
  
  
  //__get function will be called ;
  echo time() - $_SESSION[&quot;now&quot;]; // output is zero ?!
  
  </code></pre>