Skip to content

Instantly share code, notes, and snippets.

View niravmadariya's full-sized avatar
💭
I may be slow to respond.

Nirav Madariya niravmadariya

💭
I may be slow to respond.
View GitHub Profile
@niravmadariya
niravmadariya / FileOperations.php
Last active June 7, 2018 07:02
Basic file operations in PHP
<?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);
@niravmadariya
niravmadariya / GETPOST.php
Last active June 7, 2018 07:01
GET and POST exmaple in PHP
<form action="" method="POST">
<input type="submit" value="submit" name="submit" />
</form>
<form action="">
<input type="submit" value="submit" name="submit"/>
</form>
<?php
if(isset($_POST['submit'])){
echo "Submitted via POST";