I am working on some scripts that create PHP files in PHP. I am having a hard time thinking of a way to put PHP code into a file without PHP running it like it was code. For example

$var = 'Hello There';
echo '$var is a variable';

I need this to ouput $var is a variable, not Hello There is a variable. How do I make it so I could output un-processed PHP code either to the screen or a file?

    I am stupid, i used Double Quotes, single Quotes seemed to do the trick.

      And so on and on and .......
      How do you display:
      -------
      $var = 'Hello There';
      echo '$var is a variable';
      -------

      Here I found it was beginning to get complicated
      😃

      <?php
      
      /***** display this *******
      $var = 'Hello There'; 
      echo '$var is a variable';
      **************************/
      
      echo '$var = '."'Hello There';"."<br>";
      echo "echo "."'".'$var is a variable'."';";
      
      ?>
        <?php
        //PHP code that should be run.
        ?>
        //PHP code that should be output
        // (using
        // <?php echo '<?'?>
        // to prevent premature re-entry).
        <?php
        // And back to the real code
        ?>
          Write a Reply...