Link to home
Create AccountLog in
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

ASKER CERTIFIED SOLUTION
Avatar of Michael701
Michael701
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.