Grow your CSS skills. Land your dream job.

Last updated on:

Read/Write Files

Append to a file

function fileWrite($file, $message) {
  fwrite(fopen($file, 'a'), $message . "\n");
}

Read and display entire file

function fileRead($file){
   $lines = file($file);
   foreach ($lines as $line_num => $line) {
      echo  $line,  '</br>';
   }
}

Comments

  1. Small and functional PHP file reading snippet.

  2. Very elegance of the solution. Partition with can see at a glance how to use code

Leave a Comment

Current ye@r *

*May or may not contain any actual "CSS" or "Tricks".