Jump to content

Forcing title of output files in uppercase...


tonyjms2005

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.