Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If your string is:</p> <pre><code>2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres 2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres 2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres 2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres 2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres 2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres </code></pre> <p>And you only need double quotes at the begining and the end of each line you could use <a href="http://www.php.net/manual/en/function.strtr.php" rel="nofollow">strtr</a>:</p> <pre><code>$sLines = "2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres 2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres 2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres 2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres 2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres 2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres"; $arrTr = array(); $arrTr1 = array(); $arrTr[chr(13)] = '"'.chr(13).'"'; $arrTr1["\"\n"] = '"'; $sLines = strtr(strtr($sLines,$arrTr),$arrTr1); $sLines = '"'.$sLines.'"'; echo '&lt;pre&gt;'; print_r($sLines); echo '&lt;/pre&gt;'; </code></pre> <p>But, if you have lines glued by the "\n" character you can do this:</p> <pre><code>$sLines = "2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres\n2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres\n2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres\n2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres\n2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres\n2011.11.12 20:06,Teac Ous,Solid Pyroxeres,46521,Pyroxeres"; $arrTr = array(); $arrTr1 = array(); $arrTr["\n"] = '"'."\n".'"'; $sLines = strtr($sLines,$arrTr); $sLines = '"'.$sLines.'"'; echo '&lt;pre&gt;'; print_r($sLines); echo '&lt;/pre&gt;'; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload