title: Set up cookie for page visit
body: <p>I want to set up 2 cookies. One that shows how many times a user entered the page, and the other shows the date and the time of last visit.
  The code works fine, but I need my cookies set up once a day, not every time I visit the page. What I need is to set the <code>if($_COOKIE['lastTime'] != date('d-M-Y'))</code> statement, but I need to compare only the 'd-M-Y' part of <code>$_COOKIE['lastTime']</code>. Also, I can't set <code>$lastTime = date('d-M-Y')</code> (without h-i-m-s), because I need to show the date AND the time of last visit.
  Please, help.</p>
  
  <pre><code>$counter = 0;
  if(isset($_COOKIE['counter'])){
      $counter = $_COOKIE['counter'];
  }
  $counter++;
  
  $lastTime = '';
  if(isset($_COOKIE['lastTime'])){
      $lastTime = $_COOKIE['lastTime'];
  }
  $lastTime = date('d-M-Y H-i-m-s');
  
  if($_COOKIE['lastTime'] != date('d-M-Y')){
      setcookie('counter', $counter);
      setcookie('lastTime', $lastTime);
  }
  
  
  print_r('This is your ' . $_COOKIE['counter'] . ' visit');
  echo '&lt;br&gt;';
  print_r('Last visit was: ' . $_COOKIE['lastTime']); 
  </code></pre>