title: Stop parsing PHP script and output the rest of it as text?
body: <p>I have a PHP script that I want to be able to display the source code for if the user specifies the <code>source</code> GET-parameter.</p>
  
  <p>Note that <strong>this differs</strong> from <a href="https://stackoverflow.com/questions/15696464">this question</a>, where the object is to display the source of another script. I want to display the source code of the current script, but only if a condition evaluates to <code>true</code>, otherwise the script should execute as normal. </p>
  
  <p>I also <strong>do not</strong> want to display the condition-checking part of the script, just the actual <em>business part</em>.</p>
  
  <pre><code>&lt;?php
      if( isset($_GET['source']) )
          // Stop executing and display rest of script as text
  
      // The rest of the script, for example:
      $a = 1;
      $b = 2;
      $c = $a + $b;
  </code></pre>
  
  <p>So, if the user visits <a href="http://example.com/myscript.php?source=true" rel="nofollow noreferrer">http://example.com/myscript.php?source=true</a> he would get this in his browser (as text):</p>
  
  <pre><code>    // The rest of the script, for example:
      $a = 1;
      $b = 2;
      $c = $a + $b;
  </code></pre>