Jump to content

Semicolon in output


geldd001

Recommended Posts

Hello,

 

As en newbie in php i am looking to a solution for the creation of an output file with semicolon seperations in it. comma delimitied is no option because the file contains values with a comma.

 

$myFile = "data.txt";

 

$data1 = "".$text1.",".$text2.",".$text3.PHP_EOL;
$data2 = "".$text4.",".$text5.",".$text6;
 
$fp = fopen($myFile, 'w') or die('Could not open file!');  
fwrite($fp, "$data1"."$data2") or die('Could not write to file');  
fclose($fp);
 
The result is:
 
test1,test2,test3
test4,test5,test6
 
I Would like to have:
 
test1;test2;test3
test4;test5;test6
 
Thanks in advance
Link to comment
https://forums.phpfreaks.com/topic/278397-semicolon-in-output/
Share on other sites

Solved!

 

I tried that first but probably I made a mistake somewhere:

 

Changed:

$data1 = "".$text1.",".$text2.",".$text3.PHP_EOL;
$data2 = "".$text4.",".$text5.",".$text6;

 

In:

$data1 = "".$text1.";".$text2.";".$text3.PHP_EOL;

$data2 = "".$text4.";".$text5.";".$text6;
 
Thanks for support
Link to comment
https://forums.phpfreaks.com/topic/278397-semicolon-in-output/#findComment-1432358
Share on other sites

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.