If you need a CSV parser in PHP, this class is for you.

You can download the class from the repository of PhenixApp project : Phenix_File_Parser_Csv

This class open the CSV file, parse the data into the object and after you just need to use the object like an array.

1
2
3
4
5
6
7
8
9
10
$csvParser = new Phenix_File_Parser_Csv(
    $filename,   //CSV file name
    1,    //Start at row 1
    array(0 => "id", 1 => "title", 2 => "detail", 3 => "lastupdate") //Column expected to read in the CSV file.
);
 
//use like an array
foreach($csvParser as $key=>$value) {
    $date = $value['lastupdate'];
}

Tags: , , , , , , , , ,

Partager
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • MySpace
  • RSS
  • Live
  • Technorati
  • Twitter
  • Blogosphere News
  • Yahoo! Bookmarks
  • LinkedIn

Related posts:

  1. Phenix_Wiki, a parser componant for Zend Framework
  2. Phenix_View_Helper_Text2image
  3. How to use Flickr with Zend Framework?
  4. Le projet PhenixApp
  5. Phenix_View_Helper_Text2image (English)

Tags: , , , , , , , , ,

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">