title: how to use fgetcsv with strings
body: <p>How to use <code>fgetcsv</code> where the input is a string and not a resource?</p>
  
  <p>How to convert the string into a resource?</p>
  
  <p><code>fgetcsv</code> expects a file handle resource</p>
  
  <pre><code>$str = "1981;2992;19191\n392;488;299\n"some\ntext";199;222";
  $array = fgetcsv($str);
  </code></pre>
  
  <p>Can not use <code>str_getcsv</code> because then I have to split the string by <code>\n</code> before <code>str_getcsv</code>.. If some of the fields contains <code>\n</code> then the output will be incorrect</p>