title: How to format I/O data from script
body: <p>I was using a script to exclude a list of words from another list of keywords. I would like to change the format of the output. (I found the script on this website and I have made some modification.)</p>
  
  <p>Example:</p>
  
  <p>Phrase from outcome: <em>my word</em></p>
  
  <p>I would like to add quotes: <em>"my word"</em></p>
  
  <p>I was thinking that I should put the outcome in new-file.txt and after to rewrite it, but I do not understand how to capture the result. Please, kindly give me some tips. It's my first script :)</p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;?php
      $myfile = fopen("newfile1.txt", "w") or die("Unable to open file!");
      //    Open a file to write the changes - test
      $file = file_get_contents("test-action-write-a-doc-small.txt");
      //  In small.txt there are words that will be excluded from the big list  
      $searchstrings = file_get_contents("test-action-write-a-doc-full.txt");
      //  From this list the script is excluding the words that are in small.txt      
      $breakstrings = explode(',',$searchstrings);
      foreach ($breakstrings as $values){
        if(!strpos($file, $values)) {
          echo $values." = Not found;\n";
        } 
        else {
          echo $values." = Found; \n";
        }
      }
      echo "&lt;h1&gt;Outcome:&lt;/h1&gt;";  
      foreach ($breakstrings as $values){
        if(!strpos($file, $values)) {
          echo $values."\n";
        } 
      }
      fwrite($myfile, $values); //    write the result in newfile1.txt - test
  
      //    a loop is missing?
  
      fclose($myfile); //    close newfile1.txt - test
  ?&gt;   
  </code></pre>
  
  <p>There is also a little mistake in the script. It works fine however before entering the list of words in <code>test-action-write-a-doc-full.txt</code> and in <code>test-action-write-a-doc-small.txt</code> I have to put a break for the first line otherwise it does not find the first word.</p>
  
  <p>Example:</p>
  
  <p>In <code>test-action-write-a-doc-small.txt</code> words:</p>
  
  <blockquote>
    <p>pick, lol, file, cool,</p>
  </blockquote>
  
  <p>In <code>test-action-write-a-doc-full.txt</code> wwords:</p>
  
  <blockquote>
    <p>pick, bad, computer, lol, break, file.</p>
  </blockquote>
  
  <p>Outcome: </p>
  
  <blockquote>
    <p>Pick = Not found -- here is the mistake.</p>
  </blockquote>
  
  <p>It happens if I do not put a break for the first line in <code>.txt</code></p>
  
  <blockquote>
    <p>lol = Found</p>
    
    <p>file = Found</p>
  </blockquote>
  
  <p>Thanks in advance for any help! :)</p>