title: How to print $ with php
body: <p>Basically I have a block of html that I want to echo to the page and the html has the $ sign in it and the php thinks it is a variable so $1 is treated as the variable not the value and is not displayed.</p>
  
  <p>There is the standard answers here but none are working: <a href="https://stackoverflow.com/questions/4082622/php-how-to-get-to-print-using-echo">PHP: How to get $ to print using echo</a></p>
  
  <p>My next idea is to split the string at the $ and echo each part out. </p>
  
  <p>Here is the code I have tried echo and print.</p>
  
  <pre><code>foreach ($rows as $rowmk) {
      $s = $rowmk-&gt;longdescription;
      //$s = str_replace('$', '@', $s);
      $s = str_replace('$', '\$', $s);
      //echo  "$s" . "&lt;br&gt;";
      print $s;
  }
  </code></pre>
  
  <p>All help appreciated.</p>
  
  <p>OK I solved by using the character code value for $ </p>
  
  <pre><code>foreach ($rows as $rowmk) {
      $s = $rowmk-&gt;longdescription;       
      $s = str_replace('$', '&amp;#36;', $s);
      echo  $s . "&lt;br&gt;";
  }
  </code></pre>
  
  <p>I figured I should just post it anyway. </p>
  
  <p>Thanks,</p>
  
  <p>Mat</p>