View Single Post
Old 07-24-2009, 09:26 PM   #5 (permalink)
Sam Granger
The Acquainted
 
Join Date: Sep 2007
Posts: 126
Thanks: 4
Sam Granger is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
It's certainly easier then the procedural way with fopen/while(fgetcsv)/fclose. SplFileObject has been available for yonks but not many people use it (that I've seen).

If the documentation doesn't make sense, blame me (I wrote it).

Good luck.
You seriously wrote that? It worked a charm! How fast is it compared to going down the file_get_contents & explode method?

I loved the fact that the function worked fine with eg:

Quote:
"crocodile","reptile","4"
"dolphin","mammal","0"
"duck","bird","2"
"koala","mammal","4"
"salmon","fish","0"
Not just
Quote:
crocodile,reptile,4
dolphin,mammal,0
duck,bird,2
koala,mammal,4
salmon,fish,0
Also loved this, nice and simple!
PHP Code:
$file->setCsvControl('|'); 
Sam Granger is offline  
Reply With Quote