Example #1
0
 static function open($file, $state = 'r')
 {
     switch ($state) {
         case 'w':
         case 'a':
             // append
             if (CSV::$output) {
                 fclose(CSV::$output);
             }
             CSV::$output = fopen($file, $state);
             break;
         case 'r':
         default:
             if (CSV::$input) {
                 fclose(CSV::$input);
             }
             CSV::$input = fopen($file, 'r');
             break;
     }
 }