Drupal PHP Block Visiblity by Taxonomy Term (Category)

Here's a snippet of PHP code that displays a block if a node has a specific term. You set up the block to display based on the result of PHP code.

<?php
if (arg(0) == 'node' && is_numeric($id=arg(1))) {
  $t = taxonomy_node_get_terms_by_vocabulary(node_load($id),9);
  if ($t[99]) return TRUE;
} else {
  return FALSE;
} ?>

(I'm doing this because the click rate on the Google ads has declined, and the ads, with a few exceptions, like the timesheet software, don't match the content too well. So I'm going to experiment with doing my own placements for affiliate commissions.)