Avatar of mouimet
mouimet
 asked on

PHP fwrite Question

I have a tab file I am trying to write however some of the fields are occasionally blank. The tabs work fine if I print to the screen but fwrite is treating it as empty. I am trying to make the header count match the field count so I need the tabs even if the field is empty.
Partial code:
 
$test1= "test";
$test2= "";
$test3 = "";
 
$upload_file = fopen($cwd.$tmp_filename, "w");
$file_contents=$test1."\t".$test2."\t".$test3;
fwrite($upload_file, $file_contents);
fclose($upload_file);
 
print_r($file_contents);

Open in new window

PHPWeb Development Software

Avatar of undefined
Last Comment
danls

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Michael701

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
danls

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Your help has saved me hundreds of hours of internet surfing.
fblack61