Last active
June 7, 2018 07:02
-
-
Save niravmadariya/cb56821e32fde1be13a1d3c2f68523b2 to your computer and use it in GitHub Desktop.
Basic file operations in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//reading a file... | |
$myfile = fopen("webdictionary.txt", "r"); | |
echo fgets($myfile); | |
fclose($myfile); | |
//Write to a file... | |
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!"); | |
$txt = "This is new File\n"; | |
fwrite($myfile, $txt); | |
$txt = "This is some Content\n"; | |
fwrite($myfile, $txt); | |
fclose($myfile); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment