Php fputcsv and file_put_contents have high execution efficiency.

which is more efficient between php fputcsv and file_put_contents

Php
Apr.24,2022

  1. fputcsv format lines as CSV and write .csv file, and file_put_contents directly writes a string to the file. In terms of effect, the two functions are not comparable in terms of execution efficiency. I wonder what scenario the subject needs to compare the execution efficiency of these two functions?
  2. if you have to compare, file_put_contents is relatively efficient, writing directly without parsing the array and writing in the csv format.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b33d90-2bebd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b33d90-2bebd.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?