<?
  if(empty($visit)){
    setcookie("visit",1,time()+10000000);
    print("<html><h1>Welcome!<h1>");
  }
  else{
    $stndrd = array(1=>"st","nd","rd");
    $visit++;
    setcookie("visit",$visit,time()+10000000);
    print("<html><h1>Welcome Back!<h1>");
    $val = $visit%10;
    if( $val>0     && 
            $val<4     && 
            $visit!=11 && 
            $visit!=12 && 
            $visit!=13){
             print("for the $visit$stndrd[$val] time.");
    }
    else
     print("for the ".$visit."th time.");
  }

?>