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.
Menu