How can I display the last modified date on my site? I am using Drupal 7, and I would like to include a PHP snippet on my home page that displays the date the site was last updated (i.e., had content added or modified).

How can I go about doing this?
Assuming you just want to check nodes (and not other content, like users), you'll want to check the node table and find the row with the latest changed timestamp. This function should do the trick:

/**
 * Get the last updated date for nodes.
 *
 * @return
 *   A formatted date for the last updated time if there are published nodes,
 *   FALSE otherwise.
 */
function _mymodule_last_updated() {
  // Pull from cache if available
  if($cache = cache_get('mymodule_last_updated')) {
    $last_updated = $cache-&gt;data;
  }
  else {
    // Otherwise, find the timestamp for the latest node record
    $last_updated = db_select('node', 'n')
      -&gt;fields('n', array('changed'))
      -&gt;condition('status', 0, '&gt;') // only published nodes count
      -&gt;orderBy('changed', 'DESC')
      -&gt;range(0, 1)
      -&gt;execute()
      -&gt;fetchField();

    // If nothing found, return FALSE.
    if (!$last_updated) {
      return FALSE;
    }

    // Otherwise, save the data to cache for one hour.
    cache_set('mymodule_last_updated', $last_updated, 'cache', time() + 3600);
  }

  return format_date($last_updated);
}


Now, wherever you wanted to put the information, just call _mymodule_last_updated():

if ($last_update = _mymodule_last_updated()) {
  $last_update_text = t('Last updated: @name', array('@date' =&gt; $last_update));
}
else {
  $last_update_text = t('There have been no updates lately.');
}


However, I'd suggest creating custom module and defining a block. This would allow you to avoid having to mess with the PHP code any time you wanted to move the information around, and expose it to others who don't have access to the source code.

Once you've created your custom module, you want to implement the hook_block_info() and hook_block_view() hooks:

/**
 * Implements hook_block_info().
 */
function mymodule_block_info() {
  $blocks['mymodule_last_updated'] = array(
    'info' =&gt; t('Last updated block'),
  );
  return $blocks;
}

/**
 * Implements hook_block_view().
 */
function mymodule_block_view($delta = '') {
  $block = array();

  // Only act if it's our block
  if ($delta == 'mymodule_last_updated') {
    $block['subject'] = t('Last updated');

    if ($last_update = _mymodule_last_updated()) {
      $block['content'] = t('The site was last updated on @date.', array('@date' =&gt; $last_update));
    }
    else {
      $block['content'] = t('There have been no updates.');
    }
  }

  return $block;
}


Once defined, your new block would show up in Structure &rarr; Blocks.

Note: in all of these snippets, you'll want to replace mymodule with your custom module's name.