title: How to write a php file with PHP?
body: <p>I'm new in File handling. So I was wondering how would I go about to write a php file with php?</p>
  
  <p>Let's say I want to make a php script which creates a file which contains the following code:</p>
  
  <p><strong>PHP File TO be Created</strong></p>
  
  <pre><code>&lt;?php
  $item = "takes a variable from current file and put it here";
  ?&gt;
  </code></pre>
  
  <p>Let's say I have a php which took the following from my form:</p>
  
  <p><strong>Code which takes a variable and writes it to another php file, exactly as it is</strong></p>
  
  <pre><code>&lt;?php
  $item = $_GET['shirts'];
  
  //Code which writes to Php File above
  ?&gt;
  </code></pre>
  
  <p>I have no idea how to do this. Please be very explicit when you explain.
  Thanks :)</p>