Fake Count Generator


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. /**
  3.  * This function generates a fake number that starts small but gets
  4.  * bigger as time goes by. (This is the gheyest function I ever wrote.)
  5.  */
  6. function generate_fake_count() {
  7.  
  8. // Set starting time and date to date site was launched (unix timestamp).
  9. $start_time = 1296842335;
  10.  
  11. // Get current time from server.
  12. $current_time = time();
  13.  
  14. // Subtract start_time from current_time to create our fake number.
  15. $fake_count = $current_time - $start_time;
  16.  
  17. // Pad with a bunch of zeros.
  18. $fake_count = '0000000000' . $fake_count;
  19.  
  20. // Reverse the string.
  21. $fake_count = strrev($fake_count);
  22.  
  23. // Grab the first 8 characters.
  24. $fake_count = substr($fake_count, 0, 8);
  25.  
  26. // Reverse the number back again.
  27. $fake_count = strrev($fake_count);
  28.  
  29. // Return our new fake count
  30. return $fake_count;
  31. }
  32. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.