<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Thu, 23 May 2013 10:11:46 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[David Otton's Blog: php://memory, Unit Tests]]></title>
      <guid>http://www.phpdeveloper.org/news/11425</guid>
      <link>http://www.phpdeveloper.org/news/11425</link>
      <description><![CDATA[<p>
In looking to test his <a href="http://www.otton.org/2008/11/17/fputcsv-implementation-in-php/">fputscsv</a> functionality, <i>David Otton</i> found a simple way to measure its performance by using streams.
</p>
<blockquote>
Then I realised I could use PHP's (fairly) new IO streams to dump the function's output to a temporary buffer, and read it back in for comparison. Not perfect, but it removes concerns about file mutexes, permissions, unique filenames, etc. and speeds up the tests, as they never touch disc.
</blockquote>
<p>
He uses a custom stream and points it to php://memory to store and read the data from. Code is included in the post as well as example usage. It runs an assert that the value pushed into another memory chunk is the same as the first one (ensuring that the results of his fputcsv calls are valid).
</p>]]></description>
      <pubDate>Tue, 18 Nov 2008 15:42:01 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Daniel Cousineau's Blog: Outputting CSV as a Downloadable File in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/11191</guid>
      <link>http://www.phpdeveloper.org/news/11191</link>
      <description><![CDATA[<p>
In a <a href="http://www.toosweettobesour.com/2008/10/10/outputting-csv-as-a-downloadable-file-in-php/">recent post</a> to his blog <i>Daniel Cousineau</i> shows a method for correctly outputting CSV data in push down to the client browser as a method of export.
</p>
<blockquote>
Nearly every application you could write in for the business sphere in PHP probably requires some sort of data export, most likely in the CSV format. The easiest way to provide a downloadable file is by altering the headers and echo'ing the file content. 
</blockquote>
<p>
His method sets the headers for the CSV file type then pushes the content out (contained in an array) via the <a href="http://php.net/fputcsv">fputcsv</a> function. He wraps it all in a function near the end for simple cut and paste.
</p>]]></description>
      <pubDate>Mon, 13 Oct 2008 07:56:59 -0500</pubDate>
    </item>
  </channel>
</rss>
