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
<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"; |
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); |
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 | |
date_default_timezone_set('Asia/Kolkata'); | |
$hour=date('h', time()); | |
$ampm=date('a', time()); | |
if($ampm=="am"){ | |
if($hour>=1 && $hour<=11){ | |
echo "Good Morning!!!"; | |
} | |
} |
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
<html> | |
<head> | |
<title>Factorial Program using loop in PHP</title> | |
</head> | |
<body> | |
<form method="post"> | |
Enter the Number:<br> | |
<input type="number" name="number" id="number"> | |
<input type="submit" name="submit" value="Submit" /> | |
</form> |
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
<html> | |
<head><title>Reverse of a given Number in PHP</title></head> | |
<body> | |
<form method="post"> | |
Enter the Number:<br> | |
<input type="number" name="number" id="number"> | |
<input type="submit" name="submit" value="Submit" /> | |
</form> | |
<?php | |
if($_POST['submit']){ |
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
<html> | |
<head><title>Check if the number is Even or Odd</title></head> | |
<body> | |
<form method="post"> | |
Enter the Number:<br> | |
<input type="number" name="number" id="number"> | |
<input type="submit" name="submit" value="Submit" /> | |
</form> | |
<?php | |
if($_POST['submit']){ |
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 | |
echo copy("source.txt","target.txt"); | |
//Another way | |
//Get all the content from the file | |
$fileContents = file_get_contents('1.txt'); | |
//Output to new file | |
$fh = fopen('output.txt', 'w+'); | |
file_put_contents($fh, $fileContents); | |
fclose($fh); |
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 | |
$file = fopen("test.txt","w+"); | |
// exclusive lock | |
if (flock($file,LOCK_EX)) | |
{ | |
fwrite($file,"Write something"); | |
// release lock | |
flock($file,LOCK_UN); | |
} | |
else |
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 | |
$a[0] = 1; // Numeric Array | |
$a[1] = 2; | |
$a[2] = 3; | |
$a[3] = 4; | |
$a[4] = 5; | |
$b['a']='a'; // Associative Array | |
$b['b']='b'; | |
$b['c']='c'; | |
$b['d']='d'; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Sign Up Form</title> | |
</head> | |
<body> | |
<section> | |
<form class="c-form" action="" method="POST"> | |
<div> |
OlderNewer