Tag Archives: read csv file

PHP – read CSV file into an array and create files from an array

<?php $file = fopen(‘files.csv’, ‘r’); while (($line = fgetcsv($file)) !== FALSE) {  foreach ($line as $value) {    echo($value.'<br>’); $HTMLFile = fopen($value.’.html’,”w”); $TextFile = fopen($value.’.txt’,”w”); fwrite($HTMLFile,$value); fwrite($TextFile,$value);  }  } fclose($file); ?>

Posted in PHP/MySQL | Tagged , , , , | Comments Off on PHP – read CSV file into an array and create files from an array