Tag Archives: array

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

PHP – create files from an array

<?php $files_to_create = array(EM_NEO_TIPS_06501,EM_NEO_TIPS_06502,EM_NEO_TIPS_06503,EM_NEO_TIPS_06504,EM_NEO_TIPS_06505,EM_NEO_TIPS_06506,EM_NEO_TIPS_06507,EM_NEO_TIPS_06508,EM_NEO_BABYDEV_02501,EM_NEO_BABYDEV_02502,EM_NEO_BABYDEV_02503,EM_NEO_BABYDEV_02504,EM_NEO_BABYDEV_02505,EM_NEO_BABYDEV_02506,EM_NEO_BABYDEV_02507,EM_NEO_BABYDEV_02508,EM_NEO_JRNY_01501,EM_NEO_JRNY_01502,EM_NEO_JRNY_01503,EM_NEO_JRNY_01504,EM_NEO_JRNY_01505,EM_NEO_JRNY_01506,EM_NEO_JRNY_01507,EM_NEO_JRNY_01508,EM_NEO_LOY_03501,EM_NEO_LOY_03502,EM_NEO_NUTR_04501,EM_NEO_NUTR_04502,EM_NEO_NUTR_04503,EM_NEO_NUTR_04504,EM_NEO_NUTR_04505,EM_NEO_NUTR_04506,EM_NEO_NUTR_04507,EM_NEO_NUTR_04508,EM_NEO_PROD1_05501,EM_NEO_PROD1_05502,EM_NEO_PROD1_05503,EM_NEO_PROD1_05504,EM_NEO_PROD1_05505,EM_NEO_PROD1_05506,EM_NEO_PROD1_05507,EM_NEO_PROD1_05508); foreach ($files_to_create as $value) {    echo($value.'<br>’); $HTMLFile = fopen($value.’.html’,”w”); $TextFile = fopen($value.’.txt’,”w”); fwrite($HTMLFile,$value); fwrite($TextFile,$value);} ?>

Posted in PHP/MySQL | Tagged , , | Comments Off on PHP – create files from an array