Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

now echoes back contents of file being created

  • Loading branch information...
tymonaghan committed Nov 2, 2018
1 parent 9630fcf commit 58e48ca9cb7244898692e30fdc04717c024c6772
Showing with 5 additions and 1 deletion.
  1. +5 −1 php/text-to-file.php
@@ -1,6 +1,10 @@
<?php
$output = "testTEXT"; # store the string "testTEXT" as $output
file_put_contents("../sentiments.md","Text is getting appended then a line break \n", FILE_APPEND);
#non-append version (overwrite) on below line, uncomment to use
#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
$output = fopen("../sentiments.md","r");
echo fread($output,filesize("../sentiments.md"));
?>

0 comments on commit 58e48ca

Please sign in to comment.
You can’t perform that action at this time.