Creating csv content

It is tempting to simply generate CSV data with writing comma-separated  array-values. implode(",", $data_array); Unfortunately this obvious way of doing turns out to be a bad idea. Often it seems to be working at first, but eventually you’ll be faced with annoying bugs, wrongly escaped data. Fortunately, PHP has a native function to write CSV… Continue reading Creating csv content

PHP memory leak

Consider an RSS feed read in as an SimpleXMLobject $rss. What’s the difference between: foreach ($rss->channel as $channel) { … } and $foo = $rss->channel; foreach ($foo as $channel) { … } Not much you would say, the first code example is shorter and more to the point. However when putting the scripts to work,… Continue reading PHP memory leak