home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / parser.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  640 b   |  31 lines

  1. <?php
  2. $path = ini_get('include_path');
  3. ini_set('include_path', realpath('../') . ":$path");
  4. require_once 'File/CSV.php';
  5.  
  6. /*/Example conf:
  7. $conf = array(
  8.     'fields' => 4,
  9.     'sep'    => "\t",
  10.     'quote'  => '"',
  11.     'header' => false
  12. );
  13. //*/
  14. ob_implicit_flush(true);
  15. $argv = $_SERVER['argv'];
  16. $file = $argv[1];
  17. $write = (isset($argv[2])) ? $argv[2] : false;
  18. PEAR::setErrorHandling(PEAR_ERROR_PRINT, "warning: %s\n");
  19.  
  20. $conf = File_CSV::discoverFormat($file);
  21. while ($fields = File_CSV::read($file, $conf)) {
  22.     if ($write) {
  23.         File_CSV::write($write, $fields, $conf);
  24.     }
  25.     print_r($fields);
  26. }
  27.  
  28. var_dump($conf);
  29. echo "\n"
  30.  
  31. ?>