File handling is a very important concept in the world of computer science. Files are a type of portable storage used to store any type of data. Before a programmer applies any algorithm on a particular file, they need to open that file using the fopen()
command.
Only two parameters are passed into the fopen()
function:
$file = fopen("filename.txt", "r");
The following code opens a file and writes “Educative!” in it.
<?php$file = fopen("filename.txt", "w+");$company = "Educative!\n";fwrite($file, $company);fclose($file);?>
Free Resources