I want to store my PHP variable in a CSV file.
As they are individual variables and I need to store them in row columns format.
for ex- ID, First Name, Last Name, Address, Phone. etc.
suppose I have variable $id, $firstname, $lastname, $address, $phone.
How can I store this variable in a single row separated by a column in a CSV file?
I tried using an array but as they are individual variables and use in entire my program so I want to add this variable at end of the script to CSV to maintain the report.
$fp = fopen($filename, "w");
$fp = fopen("ouput.csv", w)
fputcsv($fp,array(array($id,$firstname, $lastname,$address,$phone)));
fclose($fp);
Thanks in advance.