tonyjms2005 Posted April 12, 2011 Share Posted April 12, 2011 Hi I have this script that saves data to a file, I was wondering how I can make the script write the title of the files in uppercase letters? I am new to coding mind :-\ I think is the relevent code: foreach(array('daily','weekly','monthly') as $value) { $fp = fopen(DIR.$value.'_'.strtolower(str_replace('/', '', $data[$ccyValue][0])).'.csv', 'w'); if($fp) { $raw_data = array(${$value.'Pivot'}, ${$value.'_s1'}, ${$value.'_s2'}, ${$value.'_s3'}, ${$value.'_r1'}, ${$value.'_r2'}, ${$value.'_r3'}); $write_data = "Pivot, S1, S2, S3, R1, R2, R3\n"; $write_data .= implode(',', $raw_data); fwrite($fp,$write_data); fclose($fp); } else { die('Please make sure result folder is present or writable!'); } } } Thanks Antony Quote Link to comment https://forums.phpfreaks.com/topic/233477-forcing-title-of-output-files-in-uppercase/ Share on other sites More sharing options...
maca134 Posted April 12, 2011 Share Posted April 12, 2011 Hey If i understand you correctly, this one it easy. I would save the filename in a var first: $filename = $value . '_' . str_replace('/', '', $data[$ccyValue][0]) . '.csv'; $filename = strtoupper($filename); $fp = fopen(DIR . $filename, 'w'); Thats should work Quote Link to comment https://forums.phpfreaks.com/topic/233477-forcing-title-of-output-files-in-uppercase/#findComment-1200537 Share on other sites More sharing options...
tonyjms2005 Posted April 12, 2011 Author Share Posted April 12, 2011 Hi Excellent, job done, thank you for your help. Antony Quote Link to comment https://forums.phpfreaks.com/topic/233477-forcing-title-of-output-files-in-uppercase/#findComment-1200549 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.