Return to Snippet

Revision: 40695
at February 5, 2011 05:53 by zachharkey


Updated Code
<?php
/**
 * This function generates a fake number that starts small but gets
 * bigger as time goes by. (This is the gheyest function I ever wrote.)
 */
function generate_fake_count() {

  // Set starting time and date to date site was launched (unix timestamp).
  $start_time = 1296842335;

  // Get current time from server.
  $current_time = time();

  // Subtract start_time from current_time to create our fake number.
  $fake_count = $current_time - $start_time;

  // Pad with a bunch of zeros.
  $fake_count = '0000000000' . $fake_count;

  // Reverse the string.
  $fake_count = strrev($fake_count);

  // Grab the first 8 characters.
  $fake_count = substr($fake_count, 0, 8);

  // Reverse the number back again.
  $fake_count = strrev($fake_count);

  // Return our new fake count
  return $fake_count;
}
?>

Revision: 40694
at February 5, 2011 05:48 by zachharkey


Initial Code
<?php
/**
 * Generates a fake number that starts small but gets bigger as time goes by.
 * (This is the gheyest function I ever wrote.)
 */
function generate_fake_count() {

  // Set starting time and date to date site was launched (unix timestamp).
  $start_time = 1296842335;

  // Get current time from server.
  $current_time = time();

  // Subtract start_time from current_time to create our fake number.
  $fake_count = $current_time - $start_time;

  // Pad with a bunch of zeros.
  $fake_count = '0000000000' . $fake_count;

  // Reverse the string.
  $fake_count = strrev($fake_count);

  // Grab the first 8 characters.
  $fake_count = substr($fake_count, 0, 8);

  // Reverse the number back again.
  $fake_count = strrev($fake_count);

  // Return our new fake count
  return $fake_count;
}
?>

Initial URL


Initial Description


Initial Title
Fake Count Generator

Initial Tags


Initial Language
PHP