title: Echo php code as text
body: <p>I want to echo block of code which is dynamically generated. For example:</p>
  
  <pre><code>&lt;?php
  $cid = $camp_id;
  
  $hostname = "$host";
  $db_user = "$dbuser";
  $db_pass = "$dbpass";
  $db_name = "$dbname";
  
  $mysqli = new mysqli();
  $mysqli-&gt;connect($hostname, $db_user, $db_pass, $db_name);
  if ($mysqli-&gt;connect_errno) {
      echo "Failed to connect to MySQL: " . $mysqli-&gt;connect_error;
  }
  
  etc....
  ?&gt;
  </code></pre>
  
  <p>I got access to $camp_id and other variables because they are in the file which is included.
  I tried to store this code in variable with &lt; pre> and &lt; code> tag and echo after that but couldn't make it work. </p>
  
  <p>Also how can I insert $camp_id to this. Below is example what I think (I know it's not correct just for understanding.</p>
  
  <pre><code>$generated_code = "&lt;.code&gt;&lt;?php $cid = &lt;?php echo $camp_id;?&gt; $hostname = $host; etc... &lt;/code &gt; ?&gt;";
  </code></pre>
  
  <p>I used space and dot before code and pre because if not it doesn't show as tag.. </p>
  
  <p>Thanks</p>