IHYPRESS.NET
PHP
HOME | ASP | C | CSS | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Earn Free Bitcoin
PHP ❯ Execution Time
<14>
<?php $time_start = microtime(true); // set the variable to 0, it'll matter only if the cookie for the variable is not set $visitCounter = 0; // if cookie is set for the variable, it'll go to $visitCounter and get added by 1; otherwise it'll show 0 for tha variable if(isset($_COOKIE['visitCounter'])){ $visitCounter = $_COOKIE['visitCounter']; $visitCounter ++; } // if the last visist cookie is set, it'll pass the value to $lastVisit, and it'll be displayed below; if(isset($_COOKIE['lastVisit'])){ $lastVisit = $_COOKIE['lastVisit']; } // set cookie for visitCounter setcookie('visitCounter', $visitCounter+1, time()+3600); // set cookie for last visit setcookie('lastVisit', date("d-m-Y H:i:s"), time()+3600); // show the respected values // is the variable is not set, say 'welcome', otherwise show the info about visit number and last visit date if($visitCounter == 0){ echo "Welcome<br><br>"; } else { echo "This is your visit number ".$visitCounter; echo '<br>'; echo "Last time, you were here ".$lastVisit. "<br><br>"; } $time_end = microtime(true); $time = $time_end - $time_start; echo 'Script took '.$time.' seconds to execute'; ?>
Welcome

Script took 0.0023090839385986 seconds to execute
COPYRIGHT © 2015-2024 IHYPRESS.NET. A DIVISION OF IHY PRESS. ALL RIGHTS RESERVED.