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);
?>

Thank you for reading!

It's only fair to share...Tweet about this on Twitter
Twitter
Share on Facebook
Facebook
Email this to someone
email