So, I have a string in which I want to make fputcsv that has integers (which I need to treat as strings, but they are numbers). These integers have leading zeros that are truncated when I do fputcsv, but I don't want this to happen, is there any way around this? I tried just typcasting as (string) and put my variable in quotes, but the only way I have found so far is to simply put quotes around the whole number, which leads to showing quotes in the csv file when I open excel, which I do not want. Does anyone know how to make this work? I think fputcsv just automatically assigns this type variable for some reason and makes it integer or something ...
EDIT example text:
What do I need fputcsv:
02305109
What I get in a csv file opened in excel:
2305109
but leading zero still exists when I just use vi to open the specified csv file. Really strange.
php excel csv fputcsv
noname
source share