title: php: performing math inside of an "echo". also passing variable name to a function
body: <p>I'm building a table (tho not using <code>&lt;table&gt;</code>) and populating it with data from mysql. I have the following code to build the "table":</p>
  
  <pre><code>$NYC = // data from mysql, working fine
  $NYC_min = 300;
  switch($cou_mun){
      case "New York":
          $NYC++;
          break;
      //etc
  }
  
  function cityMinMet($city){
      $city_min= "$city" . "_min";
      if($city&gt;$city_min){return "yes";}
      else{return "no";};
  }
  
  echo "&lt;h3&gt;Table 6: Recruitment by target area&lt;/h3&gt;";
  echo "&lt;ul&gt;\n&lt;li&gt;&lt;span&gt;Target Area&lt;/span&gt;&lt;span&gt;Number Recruited&lt;/span&gt;&lt;span&gt;Amount under minimum&lt;/span&gt;&lt;span&gt;Minimum&lt;/span&gt;&lt;span&gt;Minimum met?&lt;/span&gt;&lt;/li&gt;";
  echo "&lt;li&gt;&lt;span&gt;12 Jurisdictions with Highest AIDS Prevalance&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt;";
  echo "&lt;li&gt;&lt;span&gt;New York&lt;/span&gt;&lt;span&gt;$NYC&lt;/span&gt;&lt;span&gt;" . $NYC_min-$NYC . "&lt;/span&gt;&lt;span&gt;$NYC_min&lt;/span&gt;&lt;span&gt;"; cityMinMet('$NYC'); echo "&lt;/span&gt;&lt;/li&gt;";
  </code></pre>
  
  <p>I encounter a problem with <code>" . $NYC_min-$NYC . "</code>: it breaks the row (the row gets interpreted as ending just before <code>" . $NYC_min-$NYC . "</code>. However, if I have <code>&lt;span&gt;$NYC_min-$NYC&lt;/span&gt;</code> (not as an additional component of the echo), the value of the cell is printed as <code>300-500</code> instead of <code>200</code>.</p>
  
  <p>Also I'm not sure I've setup my function properly (but this is not breaking the table/row). From <code>cityMinMet('$NYC')</code> I want the literal string <code>$NYC</code> (and not its value) sent to the function. Inside the function I need to append <code>_min</code> to <code>$NYC</code> and then call <code>$NYC_min</code> and it return with its value.</p>
  
  <p><i><strong>EDIT</strong>: I changed the order of <code>$NYC</code> and <code>$NYC_min</code> in the equation.</i></p>