title: How do I escape a PHP script to an external editor and return afterwards?
body: <p>Specifically I have a PHP command-line script that at a certain point requires input from the user. I would like to be able to execute an external editor (such as vi), and wait for the editor to finish execution before resuming the script.</p>
  
  <p>My basic idea was to use a temporary file to do the editing in, and to retrieve the contents of the file afterwards. Something along the lines of:</p>
  
  <pre><code>$filename = '/tmp/script_' . time() . '.tmp';
  
  get_user_input ($filename);
  
  $input = file_get_contents ($filename);
  unlink ($filename);
  </code></pre>
  
  <p>I suspect that this isn't possible from a PHP command-line script, however I'm hoping that there's some sort of shell scripting trick that can be employed to achieve the same effect.</p>
  
  <p>Suggestions for how this can be achieved in other scripting languages are also more than welcome.</p>