Skip to content
This repository has been archived by the owner on Nov 7, 2018. It is now read-only.

Commit

Permalink
change method to file_put_contents
Browse files Browse the repository at this point in the history
  • Loading branch information
tymonaghan committed Nov 2, 2018
1 parent b37bc97 commit 9630fcf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions php/text-to-file.php
@@ -1,6 +1,6 @@
<?php
$myFile = fopen("../sentimentsss.txt","a+"); #open/create "sentimentsss.txt" as $myFile, in create/append mode!
$output = "testTEXT"; # store the string "testTEXT" as $output
fwrite($myFile,$output); # write TO $myFile, the thing to write is $output
fclose($myFile); #close the file to free resources and stop writing to it
file_put_contents("../sentiments.md","Text is getting appended then a line break \n", FILE_APPEND);
#replace fopen, fwrite, and fclose with file_put_contents
# the parameters are (file to open/write, data to write, flags [FILE_APPEND] writes in append instead of overwrite mode
?>

0 comments on commit 9630fcf

Please sign in to comment.