PHP Write File

fwrite() - Binary-safe file write

int fwrite (resource $handle ,string $string [,  int $length ]); 

fwrite() writes the contents of string to the file stream pointed to by handle.

<?php 
  $file_name = "c:\folder\resource.txt";
  $handle = fopen($file_name, "w");
  fwrite($handle, 'Hello');
  fwrite($handle, 'World');
  fclose($handle);
?>

Output:

Hello World